/* ═══════════════════════════════════════════════════════════════════════════
   DChain Explorer — global stylesheet
   All pages share these base tokens + utilities.
   Index-page (Tonviewer-style) styles are appended at the bottom.
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
  --bg:       #0b1220;
  --surface:  #111a2b;
  --surface2: #0f1729;
  --line:     #1c2840;
  --text:     #e6edf9;
  --muted:    #98a7c2;
  --accent:   #7db5ff;
  --ok:       #41c98a;
  --warn:     #f0b35a;
  --err:      #ff7a87;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", "Manrope", "Segoe UI", sans-serif;
}

/* ─── Generic Layout ─────────────────────────────────────────────────────── */

.layout {
  max-width: 1180px;
  margin: 0 auto;
  padding: 16px;
}

.breadcrumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 13px;
}

.crumb {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  text-decoration: none;
}

.crumb.active { color: var(--text); font-weight: 600; }
.crumb-sep    { color: #9ca3af; }

/* ─── Panels ─────────────────────────────────────────────────────────────── */

.panel {
  background: var(--surface);
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 14px;
}

.panel-head h1,
.panel h2 {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 18px;
  font-weight: 600;
}

.panel h2 {
  font-size: 15px;
  margin-bottom: 12px;
}

.panel-head p {
  margin: 6px 0 10px;
  color: var(--muted);
  font-size: 13px;
}

/* ─── Search Line ────────────────────────────────────────────────────────── */

.search-line {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.search-line input {
  flex: 1;
  min-width: 260px;
  border: none;
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 14px;
  background: var(--surface2);
  color: var(--text);
}

.search-line input:focus {
  outline: none;
  box-shadow: inset 0 0 0 1px #2a436c;
}

/* ─── Buttons ────────────────────────────────────────────────────────────── */

.btn {
  border: none;
  border-radius: 6px;
  padding: 10px 12px;
  background: #1a2a45;
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
}

.btn:hover { background: #21375a; }
.btn-muted  { color: var(--muted); }

/* ─── Status badge ───────────────────────────────────────────────────────── */

.status {
  margin-top: 8px;
  font-size: 12px;
  color: var(--muted);
}

.status.ok   { color: var(--ok); }
.status.warn { color: var(--warn); }
.status.err  { color: var(--err); }

/* ─── Stats Grid (other pages) ───────────────────────────────────────────── */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.stat {
  background: var(--surface);
  border-radius: 8px;
  padding: 10px;
}

.stat-key {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}

.stat-val {
  font-size: 18px;
  font-weight: 700;
  line-height: 1.25;
}

.stat-sub {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
}

.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 12px;
}

.chart-wrap {
  height: 170px;
  border-radius: 6px;
  background: var(--surface2);
  padding: 8px;
}

canvas { width: 100%; height: 100%; display: block; }

/* ─── KV Grid ────────────────────────────────────────────────────────────── */

.kv-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.kv-item {
  border-radius: 6px;
  padding: 8px;
  min-height: 62px;
  background: var(--surface2);
}

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

.kv-val {
  font-size: 14px;
  font-weight: 500;
  word-break: break-all;
}

/* ─── Tables ─────────────────────────────────────────────────────────────── */

.table-wrap { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }

th, td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

th { color: var(--muted); font-size: 12px; font-weight: 600; }

tbody tr:hover td { background: #0f1b31; }

.tbl-empty {
  color: var(--muted);
  text-align: center;
  padding: 20px;
}

/* ─── TX list (address / tx pages) ──────────────────────────────────────── */

.tx-list { display: flex; flex-direction: column; }

.tx-list .tx-row {
  padding: 10px 8px;
  border-bottom: 1px solid var(--line);
}

.tx-list .tx-row:hover { background: #0f1b31; }

.tx-empty {
  color: var(--muted);
  font-size: 13px;
  padding: 10px 8px;
}

.tx-row { cursor: pointer; }
.tx-row td { padding: 10px 8px; }

.tx-line {
  display: grid;
  grid-template-columns: 170px 220px minmax(180px, 1fr) minmax(170px, 260px) 130px;
  gap: 10px;
  align-items: center;
  min-width: 720px;
}

.tx-time  { color: var(--muted); font-size: 12px; }

.tx-action { display: flex; flex-direction: column; line-height: 1.25; }
.tx-action-title { font-weight: 600; font-size: 13px; color: var(--text); }
.tx-action-type  { font-size: 11px; color: var(--muted); }

.tx-memo-block {
  font-size: 11px;
  color: #b9c7dd;
  background: var(--surface2);
  border-radius: 6px;
  padding: 6px 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tx-memo-block.empty { color: var(--muted); }

.tx-route {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.tx-route-item {
  color: var(--accent);
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 12px;
}

.tx-route-arrow { color: var(--muted); width: 12px; height: 12px; flex: 0 0 auto; }

.tx-amount { text-align: right; font-weight: 600; font-size: 13px; }
.tx-amount.pos     { color: #41c98a; }
.tx-amount.neg     { color: #ff7a87; }
.tx-amount.neutral { color: var(--text); }

/* ─── Misc ───────────────────────────────────────────────────────────────── */

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

.raw {
  margin: 0;
  border-radius: 6px;
  padding: 10px;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
  background: var(--surface2);
}

.mono {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 12px;
}

.badge {
  display: inline-block;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 11px;
  background: #16223a;
}

.badge.sent    { color: #ffb3bf; }
.badge.recv    { color: #8cf0bf; }
.badge.neutral { color: #c9d8f0; }

.icon   { width: 13px; height: 13px; }
.lucide { width: 13px; height: 13px; stroke-width: 1.8; }


/* ═══════════════════════════════════════════════════════════════════════════
   INDEX PAGE — Tonviewer-style
   ═══════════════════════════════════════════════════════════════════════════ */

/* ─── Top Navigation ─────────────────────────────────────────────────────── */

.topnav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(11, 18, 32, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.topnav-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.topnav-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--text);
}

.topnav-brand:hover { text-decoration: none; }

.brand-gem {
  font-size: 18px;
  color: var(--accent);
  line-height: 1;
}

.brand-name {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.topnav-links {
  display: flex;
  align-items: center;
  gap: 4px;
}

.topnav-links a {
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  padding: 6px 12px;
  border-radius: 6px;
  transition: color 0.15s, background 0.15s;
}

.topnav-links a:hover {
  color: var(--text);
  background: #1a2a45;
  text-decoration: none;
}

/* ─── Hero Section ───────────────────────────────────────────────────────── */

.hero {
  background: radial-gradient(ellipse 80% 60% at 50% -10%, #1a2f5a 0%, transparent 70%),
              var(--bg);
  padding: 64px 24px 40px;
  text-align: center;
}

.hero-inner {
  max-width: 680px;
  margin: 0 auto;
}

.hero-title {
  margin: 0 0 10px;
  font-size: 36px;
  font-weight: 700;
  letter-spacing: -0.03em;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.hero-gem {
  font-size: 32px;
  color: var(--accent);
}

.hero-sub {
  margin: 0 0 28px;
  color: var(--muted);
  font-size: 14px;
  letter-spacing: 0.01em;
}

.hero-search {
  position: relative;
  display: flex;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 4px 4px 4px 16px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.hero-search:focus-within {
  border-color: #2a436c;
  box-shadow: 0 0 0 3px rgba(125, 181, 255, 0.08);
}

.hero-search-icon {
  width: 16px;
  height: 16px;
  color: var(--muted);
  flex: 0 0 auto;
  margin-right: 10px;
}

.hero-search input {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  padding: 8px 0;
  outline: none;
  min-width: 0;
}

.hero-search input::placeholder { color: var(--muted); }

.btn-hero {
  flex: 0 0 auto;
  border: none;
  border-radius: 7px;
  padding: 9px 20px;
  background: var(--accent);
  color: #05111f;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: opacity 0.15s;
}

.btn-hero:hover { opacity: 0.88; }

.hero-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 18px;
  flex-wrap: wrap;
}

.pill-link,
.pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line);
  text-decoration: none;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
  cursor: pointer;
  font-family: inherit;
}

.pill-link:hover,
.pill-btn:hover {
  color: var(--text);
  background: #1a2a45;
  border-color: #2a436c;
  text-decoration: none;
}

.pill-link .lucide,
.pill-btn .lucide {
  width: 14px;
  height: 14px;
}

.hero-status {
  margin-top: 16px;
  font-size: 12px;
  color: var(--muted);
  min-height: 18px;
}

/* setStatus() sets className="status ok/warn/err" — remap to same look */
#status.status     { margin-top: 16px; font-size: 12px; min-height: 18px; }
#status.status.ok  { color: var(--ok); }
#status.status.warn { color: var(--warn); }
#status.status.err { color: var(--err); }

/* ─── Stats Strip ────────────────────────────────────────────────────────── */

.stats-strip {
  background: var(--surface);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.strip-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 0;
  height: 80px;
  overflow-x: auto;
}

.strip-cell {
  flex: 1;
  min-width: 130px;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
}

.strip-cell-chart {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  align-items: center;
  column-gap: 12px;
  row-gap: 2px;
}

.strip-cell-chart .strip-label {
  grid-column: 1;
  grid-row: 1;
}

.strip-cell-chart .strip-val {
  grid-column: 1;
  grid-row: 2;
}

.strip-cell-chart .strip-chart {
  grid-column: 2;
  grid-row: 1 / 3;
  align-self: center;
}

.strip-label {
  font-size: 11px;
  color: var(--muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.strip-val {
  font-size: 18px;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
}

.strip-sub {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
}

.strip-chart {
  width: 80px;
  height: 36px;
  flex: 0 0 80px;
  display: block;
}

.strip-divider {
  width: 1px;
  height: 40px;
  background: var(--line);
  flex: 0 0 1px;
}

/* ─── Page Body ──────────────────────────────────────────────────────────── */

.page-body {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px;
}

/* ─── Stat Cards Row ─────────────────────────────────────────────────────── */

.cards-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.card {
  background: var(--surface);
  border-radius: 10px;
  padding: 16px;
}

.card-key {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
  margin-bottom: 10px;
}

.card-key .lucide {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
}

.card-val {
  font-size: 22px;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 4px;
}

.card-sub {
  font-size: 12px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ─── Charts Row ─────────────────────────────────────────────────────────── */

.charts-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

.charts-row .panel { margin-bottom: 0; }

/* ─── Block Detail Panel ─────────────────────────────────────────────────── */

#blockDetailPanel { }

/* ─── Responsive (index / shared) ───────────────────────────────────────── */

@media (max-width: 1080px) {
  .stats-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .split      { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .charts-row { grid-template-columns: 1fr; }
  .cards-row  { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tx-line    { grid-template-columns: 1fr; min-width: 0; gap: 6px; }
  .tx-amount  { text-align: left; }
}


/* ═══════════════════════════════════════════════════════════════════════════
   ADDRESS / WALLET PAGE
   ═══════════════════════════════════════════════════════════════════════════ */

/* ─── Search bar strip ───────────────────────────────────────────────────── */

.addr-searchbar {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  padding: 12px 24px;
}

.addr-searchbar-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* ─── Profile card ───────────────────────────────────────────────────────── */

.addr-profile-card {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  background: var(--surface);
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 14px;
}

.addr-profile-left {
  display: flex;
  align-items: flex-start;
  gap: 18px;
  flex: 1;
  min-width: 0;
}

.addr-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1a3a6e 0%, #0d2050 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 700;
  color: var(--accent);
  flex: 0 0 56px;
  text-transform: uppercase;
}

.addr-profile-info {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.addr-name {
  font-size: 20px;
  font-weight: 700;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.addr-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.addr-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.addr-badge-ok     { background: rgba(65, 201, 138, 0.12); color: #41c98a; border: 1px solid rgba(65,201,138,0.25); }
.addr-badge-accent { background: rgba(125,181,255, 0.12);  color: var(--accent);  border: 1px solid rgba(125,181,255,0.25); }
.addr-badge-relay  { background: rgba(240,179, 90, 0.12);  color: var(--warn);    border: 1px solid rgba(240,179,90,0.25); }
.addr-badge-muted  { background: rgba(152,167,194,0.08);   color: var(--muted);   border: 1px solid rgba(152,167,194,0.15); }

/* balance column (right side of profile card) */
.addr-profile-right {
  flex: 0 0 auto;
  text-align: right;
}

.addr-bal-label {
  font-size: 11px;
  color: var(--muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 4px;
}

.addr-bal-val {
  font-size: 28px;
  font-weight: 700;
  line-height: 1.1;
  color: var(--text);
}

.addr-bal-sub {
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
  font-family: "JetBrains Mono", ui-monospace, monospace;
}

/* ─── Detail KV list ─────────────────────────────────────────────────────── */

.addr-detail-panel { padding: 0; }

.addr-kv-list { display: flex; flex-direction: column; }

.addr-kv-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 13px 20px;
  border-bottom: 1px solid var(--line);
  min-height: 48px;
}

.addr-kv-row:last-child { border-bottom: none; }

.addr-kv-key {
  display: flex;
  align-items: center;
  gap: 7px;
  width: 200px;
  flex: 0 0 200px;
  font-size: 13px;
  color: var(--muted);
  font-weight: 500;
}

.addr-kv-key .lucide { width: 14px; height: 14px; flex: 0 0 auto; }

.addr-kv-val {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
  font-size: 13px;
  word-break: break-all;
}

.addr-pubkey-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

/* copy button */
.copy-btn {
  flex: 0 0 auto;
  background: none;
  border: none;
  padding: 4px;
  cursor: pointer;
  color: var(--muted);
  border-radius: 4px;
  display: flex;
  align-items: center;
  transition: color 0.15s, background 0.15s;
}

.copy-btn:hover  { color: var(--text); background: #1a2a45; }
.copy-btn-done   { color: var(--ok) !important; }
.copy-btn .lucide { width: 13px; height: 13px; }

/* ─── Node stats panel ───────────────────────────────────────────────────── */

.addr-node-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  background: var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.addr-node-cell {
  background: var(--surface2);
  padding: 14px 16px;
}

.addr-node-label {
  font-size: 11px;
  color: var(--muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 6px;
}

.addr-node-val {
  font-size: 20px;
  font-weight: 700;
}

.addr-node-sub {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}

/* ─── History panel ──────────────────────────────────────────────────────── */

.addr-hist-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.addr-hist-head h2 { margin-bottom: 0; }

.addr-hist-count {
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
  background: #1a2a45;
  padding: 2px 8px;
  border-radius: 999px;
}

/* tx table columns */
.tx-type-cell {
  display: flex;
  align-items: center;
  gap: 9px;
}

.tx-type-icon {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 30px;
}

.tx-type-icon .lucide { width: 14px; height: 14px; }

.tx-icon-recv    { background: rgba(65,201,138,0.12); color: #41c98a; }
.tx-icon-sent    { background: rgba(255,122,135,0.12); color: #ff7a87; }
.tx-icon-neutral { background: rgba(152,167,194,0.1);  color: var(--muted); }

.tx-type-name { font-size: 13px; font-weight: 600; }
.tx-type-raw  { font-size: 11px; color: var(--muted); }

.tx-block-ref {
  display: inline-block;
  font-size: 11px;
  color: var(--muted);
  background: #0f1729;
  border-radius: 4px;
  padding: 2px 6px;
  margin-top: 2px;
}

.tx-fee {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}

.addr-load-more {
  padding: 12px 0 4px;
  display: flex;
  justify-content: center;
}

.addr-load-more .btn {
  display: flex;
  align-items: center;
  gap: 6px;
}

.addr-load-more .btn .lucide { width: 14px; height: 14px; }

.text-muted { color: var(--muted); }

/* ─── Empty / error state ────────────────────────────────────────────────── */

.addr-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 64px 24px;
  text-align: center;
  gap: 12px;
}

.addr-empty-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #1a2a45;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 4px;
}

.addr-empty-icon .lucide { width: 24px; height: 24px; color: var(--muted); }

.addr-empty-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}

.addr-empty-sub {
  font-size: 13px;
  color: var(--muted);
  max-width: 360px;
  line-height: 1.5;
}

.addr-error-banner {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  background: rgba(255,122,135,0.08);
  border: 1px solid rgba(255,122,135,0.25);
  border-radius: 10px;
  padding: 16px 20px;
  margin-bottom: 16px;
}

.addr-error-icon {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255,122,135,0.15);
  display: flex;
  align-items: center;
  justify-content: center;
}

.addr-error-icon .lucide { width: 16px; height: 16px; color: var(--err); }

.addr-error-body { min-width: 0; }
.addr-error-title { font-size: 14px; font-weight: 600; color: var(--err); margin-bottom: 3px; }
.addr-error-msg   { font-size: 13px; color: var(--muted); word-break: break-all; }

/* address responsive — consolidated below */


/* ═══════════════════════════════════════════════════════════════════════════
   TRANSACTION PAGE
   ═══════════════════════════════════════════════════════════════════════════ */

/* ─── Status banner ──────────────────────────────────────────────────────── */

.tx-banner {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  background: var(--surface);
  border-radius: 12px;
  padding: 20px 24px;
  margin-bottom: 14px;
}

.tx-banner-left {
  display: flex;
  align-items: flex-start;
  gap: 16px;
}

.tx-banner-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 44px;
}

.tx-banner-icon .lucide { width: 20px; height: 20px; }

.tx-banner-ok   { background: rgba(65, 201, 138, 0.12); color: #41c98a; }
.tx-banner-warn { background: rgba(240,179,90,  0.12); color: var(--warn); }
.tx-banner-err  { background: rgba(255,122,135, 0.12); color: var(--err);  }

.tx-banner-title {
  font-size: 16px;
  font-weight: 700;
  color: #41c98a;
  margin-bottom: 4px;
}

.tx-banner-warn .tx-banner-title { color: var(--warn); }

.tx-banner-desc {
  font-size: 14px;
  color: var(--muted);
  line-height: 1.4;
}

.tx-banner-time {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  flex: 0 0 auto;
  padding-top: 2px;
}

/* ─── Overview panel ─────────────────────────────────────────────────────── */

.tx-overview-panel { padding: 0; }

/* tabs */
.tx-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--line);
  padding: 0 20px;
}

.tx-tab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  padding: 14px 16px 12px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
  margin-bottom: -1px;
}

.tx-tab:hover     { color: var(--text); }
.tx-tab-active    { color: var(--text); border-bottom-color: var(--accent); }

/* action table */
.tx-action-table { padding: 0 20px; }

.tx-action-hdr,
.tx-action-row {
  display: grid;
  grid-template-columns: 160px 1fr 1fr 160px;
  gap: 16px;
  align-items: center;
  padding: 12px 0;
}

.tx-action-hdr {
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
  border-bottom: 1px solid var(--line);
}

.tx-action-row {
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}

.tx-action-cell-action {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}

.tx-action-icon { width: 14px; height: 14px; color: var(--accent); }

.tx-action-cell-route { display: flex; align-items: center; }

.tx-action-cell-payload {
  color: var(--muted);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tx-action-cell-value { text-align: right; }

.tx-overview-amt {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

/* ─── Flow diagram ───────────────────────────────────────────────────────── */

.tx-flow {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 32px 24px 28px;
  min-height: 120px;
}

.tx-flow-node {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.tx-flow-bubble {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 700;
  text-transform: uppercase;
}

.tx-flow-from { background: rgba(125,181,255,0.12); color: var(--accent); border: 1.5px solid rgba(125,181,255,0.3); }
.tx-flow-to   { background: rgba(65, 201,138,0.12); color: #41c98a;       border: 1.5px solid rgba(65,201,138,0.3); }

.tx-flow-node-label {
  font-size: 13px;
  font-weight: 500;
  max-width: 140px;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tx-flow-node-sub {
  font-size: 11px;
  color: var(--muted);
}

/* arrow between nodes */
.tx-flow-arrow {
  flex: 1;
  min-width: 100px;
  max-width: 220px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 0 8px;
  position: relative;
  top: -8px;   /* align with bubble center */
}

.tx-flow-arrow-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
}

.tx-flow-arrow-line {
  display: flex;
  align-items: center;
  width: 100%;
  gap: 0;
}

.tx-flow-arrow-track {
  flex: 1;
  height: 1.5px;
  background: linear-gradient(to right, rgba(125,181,255,0.4), rgba(65,201,138,0.4));
}

.tx-flow-arrow-tip {
  width: 16px;
  height: 16px;
  color: #41c98a;
  flex: 0 0 auto;
}

.tx-flow-arrow-sub {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ─── Details KV (reuses addr-kv-* from address page) ───────────────────── */

.tx-type-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  background: #1a2a45;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 12px;
  color: var(--accent);
}

.tx-amount-val {
  font-size: 15px;
  font-weight: 600;
}

.tx-amount-val.pos { color: #41c98a; }

.tx-block-hash {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 11px;
  color: var(--muted);
  margin-left: 8px;
}

.tx-time-ago {
  font-size: 12px;
  color: var(--muted);
  margin-left: 8px;
}

/* ─── Raw JSON panel ─────────────────────────────────────────────────────── */

.tx-raw-pre {
  margin: 0;
  max-height: 480px;
  overflow-y: auto;
}

#paneRaw { padding: 16px 20px 20px; }
#paneOverview > .tx-action-table + .tx-flow { /* already has padding */ }

/* tx responsive — consolidated below */


/* ═══════════════════════════════════════════════════════════════════════════
   LIST PAGES  (validators / relays)
   ═══════════════════════════════════════════════════════════════════════════ */

.list-page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.list-page-header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.list-page-icon {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 52px;
}

.list-page-icon .lucide { width: 22px; height: 22px; }

.list-page-icon-val   { background: rgba(125,181,255,0.12); color: var(--accent); }
.list-page-icon-relay { background: rgba(240,179, 90,0.12); color: var(--warn);   }

.list-page-title {
  margin: 0 0 4px;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.list-page-sub {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
  max-width: 480px;
}

.list-page-header-right {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.list-page-stat {
  text-align: center;
}

.list-page-stat-val {
  font-size: 26px;
  font-weight: 700;
  line-height: 1.1;
}

.list-page-stat-label {
  font-size: 11px;
  color: var(--muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 2px;
}

/* list-page responsive — consolidated below */


/* ═══════════════════════════════════════════════════════════════════════════
   CONSOLIDATED RESPONSIVE OVERRIDES
   Single source of truth for all mobile breakpoints.
   These come last so they win over any earlier declarations.
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── 700 px — small tablets / large phones landscape ────────────────────── */
@media (max-width: 700px) {
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kv-grid    { grid-template-columns: 1fr; }

  /* ── Stats strip: stay as ONE horizontal scrollable row, no wrapping ── */
  .strip-inner   {
    flex-wrap: nowrap;
    height: 68px;
    padding: 0 12px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;           /* Firefox */
  }
  .strip-inner::-webkit-scrollbar { display: none; }  /* Chrome/Safari */

  /* Each cell is auto-sized, not stretchy */
  .strip-cell        { flex: 0 0 auto; min-width: 0; padding: 8px 10px; }
  .strip-divider     { height: 28px; flex: 0 0 1px; }
  .strip-val         { font-size: 15px; }
  .strip-label       { font-size: 10px; }

  /* Chart cells: collapse to normal column, hide canvas (too small) */
  .strip-cell-chart  {
    display: flex;
    flex-direction: column;
    gap: 2px;
  }
  .strip-chart                    { display: none; }
  .strip-cell-chart .strip-label  { grid-column: unset; grid-row: unset; }
  .strip-cell-chart .strip-val    { grid-column: unset; grid-row: unset; }
}

/* ── 600 px — phones portrait ────────────────────────────────────────────── */
@media (max-width: 600px) {
  /* ── Global spacing ─────────────────────────────────────────────────── */
  .page-body      { padding: 12px; }
  .panel          { padding: 12px; margin-bottom: 10px; border-radius: 8px; }
  .topnav-inner   { padding: 0 12px; height: 50px; }
  .addr-searchbar { padding: 10px 12px; }

  /* ── Index hero ─────────────────────────────────────────────────────── */
  .hero           { padding: 28px 12px 18px; }
  .hero-title     { font-size: 22px; gap: 8px; }
  .hero-gem       { font-size: 22px; }
  .hero-sub       { font-size: 12px; margin-bottom: 16px; }
  .hero-actions   { gap: 6px; margin-top: 12px; }
  .pill-link,
  .pill-btn       { padding: 6px 11px; font-size: 12px; }
  .pill-link .lucide,
  .pill-btn .lucide { width: 12px; height: 12px; }

  /* ── Stat cards ─────────────────────────────────────────────────────── */
  .cards-row      { grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 10px; }
  .card           { padding: 12px; border-radius: 8px; }
  .card-key       { font-size: 11px; margin-bottom: 6px; }
  .card-val       { font-size: 18px; }
  .card-sub       { font-size: 11px; }

  /* ── Address / Node: profile card ──────────────────────────────────── */
  .addr-profile-card  { flex-direction: column; padding: 14px; gap: 14px; border-radius: 8px; }
  .addr-profile-right { text-align: left; }
  .addr-bal-val       { font-size: 22px; }
  .addr-bal-sub       { font-size: 11px; }

  /* ── KV list rows ───────────────────────────────────────────────────── */
  .addr-kv-row    { padding: 10px 14px; }
  .addr-kv-key    { width: 130px; flex: 0 0 130px; font-size: 12px; }
  .addr-kv-key .lucide { width: 13px; height: 13px; }

  /* ── Node stats grid ────────────────────────────────────────────────── */
  .addr-node-grid { grid-template-columns: 1fr 1fr; }
  .addr-node-cell { padding: 10px 12px; }
  .addr-node-val  { font-size: 17px; }
  .addr-node-label { font-size: 10px; }

  /* ── TX page ────────────────────────────────────────────────────────── */
  .tx-banner          { padding: 12px 14px; flex-direction: column; gap: 10px; border-radius: 8px; }
  .tx-banner-time     { padding-top: 0; font-size: 11px; }
  .tx-banner-left     { gap: 12px; }
  .tx-banner-icon     { width: 36px; height: 36px; flex: 0 0 36px; }
  .tx-banner-icon .lucide { width: 16px; height: 16px; }
  .tx-banner-title    { font-size: 14px; }
  .tx-banner-desc     { font-size: 13px; }
  .tx-tabs            { padding: 0 12px; }
  .tx-tab             { padding: 12px 12px 10px; font-size: 13px; }
  .tx-action-table    { padding: 0 12px; }
  .tx-action-hdr,
  .tx-action-row      { grid-template-columns: 110px 1fr; gap: 10px; padding: 10px 0; }
  .tx-action-cell-payload,
  .tx-action-cell-value { display: none; }
  .tx-flow            { padding: 18px 12px; flex-direction: column; gap: 16px; }
  .tx-flow-arrow      { transform: rotate(90deg); min-width: 60px; max-width: 80px; top: 0; padding: 0; }
  .tx-flow-node-label { max-width: 200px; font-size: 12px; }
  #paneRaw            { padding: 12px; }

  /* ── List pages (validators / relays) ──────────────────────────────── */
  .list-page-header        { flex-direction: column; gap: 12px; }
  .list-page-header-right  { width: 100%; justify-content: flex-start; }
  .list-page-title         { font-size: 18px; }
  .list-page-sub           { font-size: 12px; }
  .list-page-icon          { width: 40px; height: 40px; flex: 0 0 40px; border-radius: 8px; }
  .list-page-icon .lucide  { width: 18px; height: 18px; }
  .list-page-stat-val      { font-size: 20px; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   Tokens & NFTs
   ═══════════════════════════════════════════════════════════════════════════ */

/* Token symbol pill */
.token-sym {
  display: inline-block;
  background: rgba(125, 181, 255, 0.12);
  color: var(--accent);
  border: 1px solid rgba(125, 181, 255, 0.22);
  border-radius: 6px;
  padding: 2px 9px;
  font-family: "JetBrains Mono", monospace;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  letter-spacing: 0.04em;
}
.token-sym:hover { background: rgba(125, 181, 255, 0.2); }

/* List page icon — token variant */
.list-page-icon-token {
  background: rgba(125, 181, 255, 0.12);
  color: var(--accent);
}

/* NFT grid */
.nft-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  padding: 0;
}

.nft-card {
  background: var(--surface2);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  text-decoration: none;
  color: var(--text);
  transition: border-color 0.15s, transform 0.12s;
  display: block;
}
.nft-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.nft-card-burned { opacity: 0.45; }

.nft-card-img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  display: block;
  background: var(--surface);
}
.nft-card-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 40px;
  background: var(--surface);
}
.nft-card-body { padding: 10px 12px 12px; }
.nft-card-name { font-weight: 600; font-size: 14px; margin-bottom: 4px; }
.nft-card-id   { font-size: 11px; color: var(--muted); font-family: monospace; }
.nft-card-owner{ font-size: 11px; color: var(--muted); margin-top: 4px; }

.badge-burned {
  background: rgba(255, 122, 135, 0.15);
  color: var(--err);
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 10px;
  font-weight: 600;
  vertical-align: middle;
  margin-left: 4px;
}

/* Token/NFT detail — attributes grid */
.attrs-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.attr-chip {
  background: var(--surface2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 12px;
  min-width: 90px;
}
.attr-chip-key {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 2px;
}
.attr-chip-val {
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
}

/* ── 400 px — tiny phones ────────────────────────────────────────────────── */
@media (max-width: 400px) {
  .page-body       { padding: 8px; }
  .panel           { padding: 10px; }
  .topnav-inner    { padding: 0 8px; }
  .topnav-links    { display: none; }   /* hide nav links, logo still visible */

  .cards-row       { grid-template-columns: 1fr; }

  /* KV list: stack label above value */
  .addr-kv-row     { flex-direction: column; align-items: flex-start; gap: 3px; padding: 8px 12px; }
  .addr-kv-key     { width: auto; flex: none; }

  .hero-title      { font-size: 19px; }
  .hero            { padding: 22px 8px 14px; }
  .addr-node-grid  { grid-template-columns: 1fr 1fr; }
  .addr-profile-card { padding: 12px; }

  th, td           { padding: 7px 8px; font-size: 12px; }
}
