/* ==========================================================================
   ARIA Explorer — design system
   Corporate block-explorer UI. Light by default, dark via toggle.
   Clean white surfaces, hairline borders, a confident blue accent, and
   IBM Plex typography. No gradients, no glow — built to read like
   established explorers (Etherscan / Tronscan).
   ========================================================================== */

/* --- Tokens: LIGHT (default) -------------------------------------------- */
:root,
[data-theme="light"] {
    --bg:            #f5f6fa;
    --surface:       #ffffff;
    --surface-2:     #f7f9fc;
    --surface-hover: #f3f6fb;
    --border:        #e6e9f0;
    --border-strong: #d6dbe6;

    --text:       #18202f;
    --text-muted: #59647a;
    /* Smallest text tier — must hold 4.5:1 on --bg, the lightest surface it
       sits on (table headers, placeholders, stat labels). */
    --text-dim:   #67708b;

    --accent:      #1d4ed8;
    --accent-hover:#1742b8;
    --accent-ink:  #ffffff;
    --accent-soft: #eef3ff;
    --logo-color:  #1d4ed8;

    --navy:     #06152e;
    /* Status colors double as 12-13% pill tints; values must keep 4.5:1
       against their own tint, not just against white. */
    --positive: #107a38;
    --negative: #c92020;
    --warning:  #955808;

    --shadow:      0 1px 2px rgba(16, 24, 40, 0.05);
    --shadow-pop:  0 8px 28px -8px rgba(16, 24, 40, 0.22);

    color-scheme: light;
}

/* --- Tokens: DARK -------------------------------------------------------- */
[data-theme="dark"] {
    --bg:            #0a0e17;
    --surface:       #11151f;
    --surface-2:     #151b27;
    --surface-hover: #1a2130;
    --border:        #222a39;
    --border-strong: #303a51;

    --text:       #e7eaf1;
    --text-muted: #9aa4b8;
    --text-dim:   #8590a8;

    --accent:      #4f8cff;
    --accent-hover:#6ba0ff;
    /* The dark accent is bright; white text on it fails 4.5:1. Filled
       controls use near-black ink instead. */
    --accent-ink:  #0a0e17;
    --accent-soft: rgba(79, 140, 255, 0.14);
    --logo-color:  #ffffff;

    --navy:     #d7e2f7;
    --positive: #29c46b;
    --negative: #f3666a;
    --warning:  #e0922f;

    --shadow:     0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-pop: 0 10px 30px -8px rgba(0, 0, 0, 0.7);

    color-scheme: dark;
}

:root {
    --radius:    8px;
    --radius-sm: 6px;
    --maxw:      1280px;
    --nav-h:     64px;
    --font-sans: "IBM Plex Sans", system-ui, sans-serif;
    --font-mono: "IBM Plex Mono", ui-monospace, monospace;
    --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- Reset --------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
/* `clip` (not `hidden`) contains the off-canvas mobile drawer without
   creating a scroll container — so the sticky navbar keeps working. */
html { -webkit-text-size-adjust: 100%; overflow-x: clip; }

body {
    font-family: var(--font-sans);
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.55;
    /* Sticky footer: the page area grows, so the footer sits at the viewport
       bottom even on short pages (404, empty states). */
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
    transition: background-color 0.25s var(--ease), color 0.25s var(--ease);
}

img, svg { display: block; max-width: 100%; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); text-decoration: none; }
button { font: inherit; cursor: pointer; }
::selection { background: var(--accent); color: var(--accent-ink); }

/* Universal keyboard focus ring. The search field is the one exception:
   its input stays unringed and the wrapper carries the halo via :focus-within. */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 99px; border: 3px solid var(--bg); background-clip: content-box; }

/* --- Typography ---------------------------------------------------------- */
h1, h2, h3, h4 { font-family: var(--font-sans); font-weight: 600; line-height: 1.2; letter-spacing: -0.01em; color: var(--text); text-wrap: balance; }
.mono { font-family: var(--font-mono); }
.num  { font-variant-numeric: tabular-nums; }
/* Entity-type label for hash headings (the heading itself is unreadable as a
   title). Normal case on purpose — uppercase tracking is reserved for data
   labels (table headers, stat labels). */
.entity-label { font-size: 13px; font-weight: 500; color: var(--text-muted); }
.muted { color: var(--text-muted); }
.dim { color: var(--text-dim); }

/* --- Layout -------------------------------------------------------------- */
.container { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }
.page { padding-bottom: 56px; flex: 1 0 auto; }
.section { margin-top: 20px; }
.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.flex { display: flex; align-items: center; }
.gap-8 { gap: 8px; } .gap-12 { gap: 12px; }
.right { text-align: right; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* --- Top bar ------------------------------------------------------------- */
.topbar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    font-size: 12.5px;
    color: var(--text-muted);
}
.topbar .container { display: flex; align-items: center; justify-content: space-between; height: 36px; }
.topbar .ticker { display: flex; gap: 20px; }
.topbar b { color: var(--text); font-weight: 600; }
.topbar .accent { color: var(--accent); }

/* --- Navbar -------------------------------------------------------------- */
.nav { position: sticky; top: 0; z-index: 50; height: var(--nav-h); background: var(--surface); border-bottom: 1px solid var(--border); }
.nav .container { display: flex; align-items: center; gap: 24px; height: 100%; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 19px; letter-spacing: -0.02em; color: var(--text); }
.brand-logo { width: 30px; height: 30px; color: var(--logo-color); transition: color 0.25s var(--ease); flex: none; }
.brand .tag { font-family: var(--font-mono); font-size: 9px; font-weight: 500; letter-spacing: 0.1em; color: var(--accent); background: var(--accent-soft); padding: 2px 6px; border-radius: 4px; text-transform: uppercase; }
.nav-links { display: flex; align-items: center; gap: 2px; margin-left: 8px; }
.nav-links a { color: var(--text-muted); font-weight: 500; font-size: 14px; padding: 8px 12px; border-radius: 7px; transition: color 0.15s, background 0.15s; }
.nav-links a:hover { color: var(--text); background: var(--surface-2); }
.nav-links a.active { color: var(--accent); }
.nav-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.icon-btn { width: 38px; height: 38px; border-radius: 8px; display: inline-grid; place-items: center; background: var(--surface); border: 1px solid var(--border); color: var(--text-muted); transition: all 0.15s; }
.icon-btn:hover { color: var(--accent); border-color: var(--border-strong); }
.theme-toggle .moon { display: none; }
[data-theme="dark"] .theme-toggle .moon { display: block; }
[data-theme="dark"] .theme-toggle .sun { display: none; }

/* --- Buttons ------------------------------------------------------------- */
.btn { display: inline-flex; align-items: center; gap: 7px; padding: 9px 15px; border-radius: 7px; font-weight: 600; font-size: 13.5px; border: 1px solid transparent; transition: all 0.15s; white-space: nowrap; }
.btn-accent { background: var(--accent); color: var(--accent-ink); }
.btn-accent:hover { background: var(--accent-hover); color: var(--accent-ink); }
.btn-ghost { background: var(--surface); border-color: var(--border-strong); color: var(--text); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); border-color: var(--border-strong); }
.btn-block { width: 100%; justify-content: center; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

/* --- Hero / search ------------------------------------------------------- */
.hero { padding: 30px 0 4px; }
.hero h1 { font-size: clamp(22px, 3vw, 28px); font-weight: 700; }
.hero .lead { color: var(--text-muted); margin-top: 4px; font-size: 14px; }

.search { position: relative; margin-top: 18px; z-index: 200; }
.search-field { display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 10px; padding: 5px 5px 5px 14px; box-shadow: var(--shadow); transition: border-color 0.15s, box-shadow 0.15s; }
.search-field:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search-field svg { color: var(--text-dim); flex: none; }
.search-field input { flex: 1; background: none; border: none; outline: none; color: var(--text); font-size: 14px; font-family: var(--font-sans); padding: 9px 0; }
.search-field input::placeholder { color: var(--text-dim); }

.autocomplete {
    position: absolute; left: 0; right: 0; top: calc(100% + 6px);
    z-index: 1000;
    background: var(--surface); border: 1px solid var(--border-strong); border-radius: 10px;
    box-shadow: var(--shadow-pop); overflow: hidden; display: none;
}
.autocomplete.open { display: block; }
.ac-item { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--border); }
.ac-item:last-child { border-bottom: none; }
.ac-item:hover, .ac-item.cursor { background: var(--surface-hover); }
.ac-item .ac-type { font-size: 10px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--accent); background: var(--accent-soft); border-radius: 4px; padding: 3px 7px; flex: none; }
.ac-item .ac-value { font-family: var(--font-mono); font-size: 12.5px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ac-empty { padding: 14px; color: var(--text-dim); font-size: 13px; text-align: center; }

/* --- Network panel (dashboard summary) ---------------------------------- */
.netpanel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); margin-top: 18px; overflow: hidden; }
.netpanel-grid { display: grid; grid-template-columns: 1fr 1fr 1.5fr; }
.np-col { padding: 6px 24px; border-right: 1px solid var(--border); }
.np-col:last-child { border-right: none; }
.np-cell { display: flex; align-items: center; gap: 14px; padding: 18px 0; }
.np-cell + .np-cell { border-top: 1px solid var(--border); }
.np-ic { width: 36px; height: 36px; border-radius: 8px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); flex: none; }
.np-label { font-size: 11px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--text-dim); }
.np-value { font-size: 16px; font-weight: 600; margin-top: 2px; font-variant-numeric: tabular-nums; }
.np-sub { font-size: 12px; color: var(--text-muted); }
.np-chart { padding: 16px 24px; display: flex; flex-direction: column; }
.np-chart .np-label { margin-bottom: 4px; }
.netpanel-foot { display: flex; flex-wrap: wrap; gap: 8px 28px; padding: 12px 24px; border-top: 1px solid var(--border); background: var(--surface-2); font-size: 12.5px; color: var(--text-muted); }
.netpanel-foot b { color: var(--text); font-weight: 600; }

/* SVG chart */
.chart { width: 100%; height: 84px; display: block; }
.chart .line { fill: none; stroke: var(--accent); stroke-width: 2; vector-effect: non-scaling-stroke; }
.chart .area { fill: var(--accent); opacity: 0.08; }
.chart-axis { display: flex; justify-content: space-between; font-size: 10.5px; color: var(--text-dim); margin-top: 6px; }

/* --- Cards --------------------------------------------------------------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 15px 18px; border-bottom: 1px solid var(--border); }
.card-head h2, .card-head h3 { font-size: 15px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.card-head .sub { font-size: 12px; color: var(--text-dim); }
.card-body { padding: 18px; }
.card-pad-0 { padding: 0; }
.card-foot { padding: 13px 18px; border-top: 1px solid var(--border); background: var(--surface-2); text-align: center; }
.card-foot a { font-size: 12.5px; font-weight: 600; color: var(--text-muted); display: inline-flex; align-items: center; gap: 6px; }
.card-foot a:hover { color: var(--accent); }

/* --- Feed rows (blocks / transactions) ---------------------------------- */
.feed { display: flex; flex-direction: column; }
.feed-row { display: flex; align-items: center; gap: 13px; padding: 13px 18px; border-bottom: 1px solid var(--border); transition: background 0.12s; }
.feed-row:last-child { border-bottom: none; }
.feed-row:hover { background: var(--surface-hover); }
.feed-row .glyph { width: 38px; height: 38px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--border); display: grid; place-items: center; color: var(--text-muted); flex: none; }
.feed-row .col { min-width: 0; }
.feed-row .grow { flex: 1; }
.feed-row .right { margin-left: auto; text-align: right; flex: none; }
.feed-label { font-size: 11.5px; color: var(--text-dim); }
.feed-strong { font-weight: 600; color: var(--text); }
.feed-row a.feed-strong:hover, .feed-row .accent-link { color: var(--accent); }

@keyframes flash-in { from { background: var(--accent-soft); } to { background: transparent; } }
.feed-row.is-new { animation: flash-in 1.6s var(--ease); }

/* --- Pills / amounts ----------------------------------------------------- */
.pill { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 500; padding: 3px 9px; border-radius: 6px; border: 1px solid var(--border-strong); color: var(--text-muted); background: var(--surface-2); font-variant-numeric: tabular-nums; }
.pill-accent { color: var(--accent); border-color: transparent; background: var(--accent-soft); }
.pill-in  { color: var(--positive); border-color: transparent; background: color-mix(in srgb, var(--positive) 12%, transparent); }
.pill-out { color: var(--warning); border-color: transparent; background: color-mix(in srgb, var(--warning) 13%, transparent); }
.amount { font-family: var(--font-mono); font-size: 13px; font-weight: 500; font-variant-numeric: tabular-nums; white-space: nowrap; }
.amount .unit { color: var(--text-dim); font-size: 0.85em; margin-left: 3px; }

/* Value chip (Etherscan-style boxed amount) */
.chip { display: inline-block; font-family: var(--font-mono); font-size: 12px; padding: 3px 8px; border: 1px solid var(--border-strong); border-radius: 6px; color: var(--text); background: var(--surface); white-space: nowrap; }

/* Status dot */
.status { display: inline-flex; align-items: center; gap: 7px; font-weight: 500; color: var(--positive); }
.status .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--positive); position: relative; }
.status .dot::after { content: ""; position: absolute; inset: -3px; border-radius: 50%; border: 1px solid var(--positive); opacity: 0; animation: ping 1.8s ease-out infinite; }
@keyframes ping { 0% { transform: scale(0.6); opacity: 0.7; } 100% { transform: scale(1.9); opacity: 0; } }

/* --- Page header --------------------------------------------------------- */
.page-head { padding: 26px 0 2px; display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.page-head h2 { font-size: clamp(20px, 2.4vw, 26px); font-weight: 700; margin-top: 3px; }

/* --- Tables -------------------------------------------------------------- */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.data thead th { text-align: left; font-size: 11px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-dim); padding: 12px 16px; background: var(--surface-2); border-bottom: 1px solid var(--border); white-space: nowrap; }
/* Sticky table headers. Long tables scroll within their own region (.is-scroll)
   so the header can stick to the top of that region — a page-level sticky is
   defeated by the mobile drawer's overflow containment on <html>. */
.table-wrap.is-scroll { max-height: 72vh; overflow: auto; }
.table-wrap.is-scroll thead th { position: sticky; top: 0; z-index: 3; box-shadow: 0 1px 0 var(--border); }
table.data tbody td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.data tbody tr:last-child td { border-bottom: none; }
table.data tbody tr:hover { background: var(--surface-hover); }
table.data .right { text-align: right; }

/* --- Detail key/value ---------------------------------------------------- */
.kv { display: flex; flex-direction: column; }
.kv-row { display: grid; grid-template-columns: 230px 1fr; gap: 16px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.kv-row:last-child { border-bottom: none; }
.kv-row .k { color: var(--text-muted); font-size: 13px; display: flex; align-items: center; gap: 7px; }
.kv-row .v { min-width: 0; word-break: break-word; }
.kv-row .v .mono { font-size: 13px; }

.copy { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 6px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text-dim); transition: all 0.15s; vertical-align: middle; }
.copy:hover { color: var(--accent); border-color: var(--border-strong); }
.copy.done { color: var(--positive); }

/* --- Empty / error ------------------------------------------------------- */
.empty { text-align: center; padding: 64px 20px; }
.empty .code { font-size: 84px; font-weight: 700; line-height: 1; color: var(--accent); letter-spacing: -0.03em; }
.empty h2 { font-size: 22px; margin-top: 6px; }
.empty p { color: var(--text-muted); margin-top: 6px; }

/* --- Footer -------------------------------------------------------------- */
.footer { border-top: 1px solid var(--border); margin-top: 48px; padding: 26px 0; background: var(--surface); }
.footer .container { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; color: var(--text-dim); font-size: 13px; }
.footer .links { display: flex; gap: 18px; }
.footer .links a { color: var(--text-muted); }
.footer .links a:hover { color: var(--accent); }

/* --- Reveal -------------------------------------------------------------- */
@keyframes fade-up { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.reveal { opacity: 0; animation: fade-up 0.45s var(--ease) forwards; }

@media (prefers-reduced-motion: reduce) { * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; } }

/* --- Stat blocks (address page) ----------------------------------------- */
.stat-label { font-size: 11px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--text-dim); }
.stat-value { font-size: 20px; font-weight: 600; margin-top: 5px; font-variant-numeric: tabular-nums; }
.arrow-h { color: var(--text-dim); }

/* --- Tooltips (data-tip) ------------------------------------------------- */
[data-tip] { position: relative; }
[data-tip]::after {
    content: attr(data-tip);
    position: absolute; left: 50%; bottom: calc(100% + 8px);
    transform: translateX(-50%) translateY(4px);
    background: var(--text); color: var(--surface);
    font-family: var(--font-sans); font-size: 11.5px; font-weight: 500; line-height: 1;
    letter-spacing: 0; text-transform: none; white-space: nowrap;
    padding: 6px 8px; border-radius: 6px; box-shadow: var(--shadow-pop);
    opacity: 0; pointer-events: none; transition: opacity 0.15s, transform 0.15s; z-index: 600;
}
[data-tip]::before {
    content: ""; position: absolute; left: 50%; bottom: calc(100% + 3px);
    transform: translateX(-50%); border: 5px solid transparent; border-top-color: var(--text);
    opacity: 0; pointer-events: none; transition: opacity 0.15s; z-index: 600;
}
[data-tip]:hover::after, [data-tip]:focus-visible::after { opacity: 1; transform: translateX(-50%) translateY(0); }
[data-tip]:hover::before, [data-tip]:focus-visible::before { opacity: 1; }

/* --- Timestamp Age <-> Date toggle -------------------------------------- */
.ts { cursor: pointer; border-bottom: 1px dashed transparent; transition: border-color 0.15s; }
.ts:hover { border-bottom-color: var(--border-strong); }
th.ts-toggle { cursor: pointer; user-select: none; }
th.ts-toggle:hover { color: var(--accent); }
th.ts-toggle .ts-arrow { display: inline-block; margin-left: 4px; opacity: 0.6; }

/* --- Inline copy affordance --------------------------------------------- */
.copy-inline { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 5px; border: 1px solid transparent; background: transparent; color: var(--text-dim); transition: all 0.15s; vertical-align: middle; margin-left: 4px; }
.copy-inline:hover { color: var(--accent); background: var(--surface-2); border-color: var(--border); }
.copy-inline.done { color: var(--positive); }
.copyable { display: inline-flex; align-items: center; max-width: 100%; }
.copyable > .mono { overflow: hidden; text-overflow: ellipsis; }

/* --- Toasts -------------------------------------------------------------- */
.toast-stack { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 1000; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { display: inline-flex; align-items: center; gap: 8px; background: var(--text); color: var(--surface); font-size: 13px; font-weight: 500; padding: 10px 14px; border-radius: 8px; box-shadow: var(--shadow-pop); transform: translateY(12px); opacity: 0; transition: opacity 0.2s var(--ease), transform 0.2s var(--ease); max-width: 90vw; }
.toast.show { transform: translateY(0); opacity: 1; }
.toast svg { color: var(--positive); flex: none; }

/* --- Skeletons ----------------------------------------------------------- */
.skeleton { position: relative; overflow: hidden; background: var(--surface-2); border-radius: 6px; }
.skeleton::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--surface-hover) 70%, transparent), transparent); animation: shimmer 1.3s infinite; }
@keyframes shimmer { 100% { transform: translateX(100%); } }
.skeleton-row { display: flex; align-items: center; gap: 13px; padding: 13px 18px; border-bottom: 1px solid var(--border); }
.skeleton-row:last-child { border-bottom: none; }
.sk-glyph { width: 38px; height: 38px; border-radius: 8px; flex: none; }
.sk-lines { flex: 1; display: flex; flex-direction: column; gap: 7px; }
.sk-line { height: 9px; border-radius: 5px; }
.sk-line.sk-60 { width: 60%; } .sk-line.sk-40 { width: 40%; } .sk-line.sk-30 { width: 30%; }
.sk-pill { width: 64px; height: 22px; border-radius: 6px; flex: none; }
.skeleton-text { display: inline-block; width: 72px; height: 1em; border-radius: 4px; vertical-align: -2px; }

/* --- Charts (ApexCharts) ------------------------------------------------- */
.chart-box { width: 100%; min-height: 132px; }
.np-chart .chart-box { height: 150px; margin: 0 -6px; }
.np-spark { margin-left: auto; width: 92px; height: 34px; flex: none; }
.chart-fallback { width: 100%; }
.apexcharts-canvas { font-family: var(--font-sans) !important; }
.apexcharts-tooltip.apexcharts-theme-light,
.apexcharts-tooltip.apexcharts-theme-dark { background: var(--surface) !important; border: 1px solid var(--border-strong) !important; box-shadow: var(--shadow-pop) !important; color: var(--text) !important; }
.apexcharts-tooltip-title { background: var(--surface-2) !important; border-bottom: 1px solid var(--border) !important; font-family: var(--font-sans) !important; font-weight: 600 !important; }
.apexcharts-xaxistooltip, .apexcharts-yaxistooltip { background: var(--surface) !important; border-color: var(--border-strong) !important; color: var(--text) !important; }
.apexcharts-xaxistooltip-bottom::before, .apexcharts-xaxistooltip-bottom::after { border-bottom-color: var(--surface) !important; }
.apexcharts-gridline { stroke: var(--border); }
.apexcharts-xaxis-label, .apexcharts-yaxis-label { fill: var(--text-dim); }

/* --- Breadcrumbs --------------------------------------------------------- */
.crumbs { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; font-size: 13px; color: var(--text-muted); padding-top: 22px; }
.crumbs a { color: var(--text-muted); }
.crumbs a:hover { color: var(--accent); }
.crumbs .sep { color: var(--text-dim); display: inline-flex; }
.crumbs .current { color: var(--text); font-weight: 500; max-width: 60vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crumbs + .page-head { padding-top: 10px; }

/* --- Prev / next entity nav --------------------------------------------- */
.entnav { display: inline-flex; align-items: center; gap: 6px; }
.entnav .nav-btn { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 8px; background: var(--surface); border: 1px solid var(--border-strong); color: var(--text-muted); transition: all 0.15s; }
.entnav .nav-btn:hover { color: var(--accent); border-color: var(--accent); }
.entnav .nav-btn.is-disabled { opacity: 0.4; pointer-events: none; }
.entnav .ent-label { font-size: 12px; color: var(--text-dim); padding: 0 4px; font-variant-numeric: tabular-nums; }

/* --- Richer empty states ------------------------------------------------- */
.empty .empty-ic { width: 46px; height: 46px; margin: 0 auto 14px; color: var(--text-dim); display: grid; place-items: center; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); }
.empty .empty-ic svg { width: 24px; height: 24px; }
.empty h3 { font-size: 16px; font-weight: 600; }
.empty .hint { font-size: 13px; color: var(--text-muted); margin-top: 4px; }

/* --- Address head / identicon ------------------------------------------- */
.addr-head { display: flex; align-items: center; gap: 14px; min-width: 0; }
.addr-avatar { width: 56px; height: 56px; border-radius: 12px; overflow: hidden; border: 1px solid var(--border); flex: none; box-shadow: var(--shadow); }
.addr-avatar .identicon { width: 100%; height: 100%; display: block; }

/* --- Tabs ---------------------------------------------------------------- */
.tablist { display: flex; gap: 4px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.tab { background: none; border: none; border-bottom: 2px solid transparent; padding: 10px 14px; font-size: 14px; font-weight: 600; color: var(--text-muted); display: inline-flex; align-items: center; gap: 8px; margin-bottom: -1px; transition: color 0.15s, border-color 0.15s; }
.tab:hover { color: var(--text); }
.tab.is-active { color: var(--accent); border-bottom-color: var(--accent); }
.tab-count { font-size: 11px; font-weight: 600; color: var(--text-muted); background: var(--surface-2); border: 1px solid var(--border); border-radius: 99px; padding: 1px 8px; font-variant-numeric: tabular-nums; }
.tab.is-active .tab-count { color: var(--accent); background: var(--accent-soft); border-color: transparent; }
.tab-panel { display: none; margin-top: 18px; }
.tab-panel.is-active { display: block; }

/* --- QR modal ------------------------------------------------------------ */
.qr-modal { position: fixed; inset: 0; z-index: 90; display: flex; align-items: center; justify-content: center; background: rgba(6, 21, 46, 0.5); padding: 20px; }
[data-theme="dark"] .qr-modal { background: rgba(0, 0, 0, 0.62); }
.qr-modal[hidden] { display: none; }
.qr-card { background: var(--surface); border: 1px solid var(--border-strong); border-radius: 14px; box-shadow: var(--shadow-pop); padding: 22px; width: 300px; max-width: 92vw; text-align: center; }
.qr-title { font-weight: 600; font-size: 15px; margin-bottom: 14px; }
.qr-canvas { display: grid; place-items: center; min-height: 220px; background: #fff; border-radius: 10px; padding: 10px; }
.qr-canvas canvas { display: block; }
.qr-addr { font-size: 11.5px; color: var(--text-muted); word-break: break-all; margin: 14px 0; }

/* --- Status page --------------------------------------------------------- */
.status-banner { display: flex; align-items: center; gap: 14px; padding: 18px; border-bottom: 1px solid var(--border); }
.status-banner .sb-dot { width: 14px; height: 14px; border-radius: 50%; flex: none; }
.status-banner.is-ok .sb-dot { background: var(--positive); box-shadow: 0 0 0 4px color-mix(in srgb, var(--positive) 18%, transparent); }
.status-banner.is-warn .sb-dot { background: var(--warning); box-shadow: 0 0 0 4px color-mix(in srgb, var(--warning) 18%, transparent); }
.status-banner.is-down .sb-dot { background: var(--negative); box-shadow: 0 0 0 4px color-mix(in srgb, var(--negative) 18%, transparent); }
.sb-title { font-weight: 600; font-size: 16px; }
.sb-sub { font-size: 12.5px; color: var(--text-dim); margin-top: 2px; }
.checks { display: flex; flex-direction: column; }
.check { display: flex; align-items: center; gap: 13px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.check:last-child { border-bottom: none; }
.check-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.check-dot.is-ok { background: var(--positive); }
.check-dot.is-warn { background: var(--warning); }
.check-dot.is-down { background: var(--negative); }
.pill-danger { color: var(--negative); border-color: transparent; background: color-mix(in srgb, var(--negative) 12%, transparent); }
.check-main { flex: 1; min-width: 0; }
.check-name { font-weight: 600; font-size: 14px; }
.check-detail { font-size: 12.5px; margin-top: 1px; }

/* --- API reference page -------------------------------------------------- */
.ep-list { display: flex; flex-direction: column; }
.ep { padding: 15px 18px; border-bottom: 1px solid var(--border); }
.ep:last-child { border-bottom: none; }
.ep-line { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.api-method { font-size: 11px; font-weight: 700; letter-spacing: 0.04em; color: var(--positive); background: color-mix(in srgb, var(--positive) 13%, transparent); border-radius: 5px; padding: 3px 8px; }
.api-path { font-size: 13.5px; color: var(--text); }
a.api-path:hover { color: var(--accent); }
.ep-desc { font-size: 13px; color: var(--text-muted); margin-top: 6px; }
.ep-params { margin-top: 8px; display: flex; flex-direction: column; gap: 5px; }
.ep-param { font-size: 12.5px; }
code.ic { font-family: var(--font-mono); font-size: 0.92em; background: var(--surface-2); border: 1px solid var(--border); border-radius: 5px; padding: 1px 6px; color: var(--text); }
.codeblock { font-family: var(--font-mono); font-size: 12.5px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 14px 16px; overflow-x: auto; color: var(--text); line-height: 1.5; margin: 0; }

/* --- Network metrics strip ----------------------------------------------- */
.metrics { grid-template-columns: repeat(4, 1fr); }
.metric { display: flex; align-items: center; gap: 14px; }
.metric-ic { width: 40px; height: 40px; border-radius: 9px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); flex: none; }

/* --- Sortable tables + autocomplete recents ----------------------------- */
/* Sort / timestamp-toggle headers hold a real <button> (keyboard-operable);
   the button disappears into the header label and carries the glyph. */
.th-btn { background: none; border: none; padding: 0; font: inherit; letter-spacing: inherit; text-transform: inherit; color: inherit; cursor: pointer; display: inline-flex; align-items: center; }
th.th-sort { cursor: pointer; user-select: none; }
th.th-sort:hover { color: var(--accent); }
th.th-sort .th-btn::after { content: "⇅"; opacity: 0.35; margin-left: 5px; font-size: 10px; }
th.th-sort.sort-asc .th-btn::after { content: "▲"; opacity: 0.9; }
th.th-sort.sort-desc .th-btn::after { content: "▼"; opacity: 0.9; }
.ac-head { padding: 9px 14px 5px; font-size: 10px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-dim); }
.ac-type-recent { background: var(--surface-2) !important; color: var(--text-muted) !important; }
.ac-clear { display: block; width: 100%; text-align: center; padding: 10px; font-size: 12px; font-weight: 500; color: var(--text-muted); background: var(--surface-2); border: none; border-top: 1px solid var(--border); cursor: pointer; }
.ac-clear:hover { color: var(--accent); }

/* --- Numbered pagination ------------------------------------------------- */
.card-foot.pager-foot { padding: 0; text-align: left; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 12px 18px; }
.pager-info { font-size: 13px; color: var(--text-muted); }
.pager-info b { color: var(--text); font-weight: 600; }
.pager-btns { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.pg { display: inline-grid; place-items: center; min-width: 34px; height: 34px; padding: 0 11px; border-radius: 7px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-muted); font-size: 13px; font-weight: 500; font-variant-numeric: tabular-nums; transition: all 0.15s; }
.pg:hover { color: var(--accent); border-color: var(--accent); }
.pg.is-current { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); cursor: default; }
.pg.is-disabled { opacity: 0.45; pointer-events: none; }
.pg-gap { color: var(--text-dim); padding: 0 2px; }

/* --- Mobile nav / drawer ------------------------------------------------- */
.nav-toggle { display: none; }
.nav-toggle .ic-close { display: none; }
.nav-toggle.is-open .ic-open { display: none; }
.nav-toggle.is-open .ic-close { display: block; }
.nav-scrim { position: fixed; inset: 0; background: rgba(6, 21, 46, 0.45); z-index: 60; opacity: 0; animation: scrim-in 0.2s var(--ease) forwards; }
[data-theme="dark"] .nav-scrim { background: rgba(0, 0, 0, 0.6); }
@keyframes scrim-in { to { opacity: 1; } }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(82vw, 320px); background: var(--surface); border-left: 1px solid var(--border); z-index: 70; transform: translateX(100%); transition: transform 0.28s var(--ease); display: flex; flex-direction: column; padding: 18px 16px; box-shadow: var(--shadow-pop); overflow-y: auto; }
.drawer.open { transform: translateX(0); }
.drawer-links { display: flex; flex-direction: column; gap: 2px; }
.drawer-links a { padding: 12px 14px; border-radius: 8px; color: var(--text); font-weight: 500; font-size: 15px; }
.drawer-links a:hover { background: var(--surface-2); }
.drawer-links a.active { color: var(--accent); background: var(--accent-soft); }
.drawer-foot { margin-top: auto; display: flex; flex-direction: column; gap: 4px; padding-top: 18px; border-top: 1px solid var(--border); }
.drawer-foot a { color: var(--text-muted); font-size: 14px; padding: 8px 14px; }
.drawer-foot a:hover { color: var(--accent); }
body.nav-open { overflow: hidden; }

/* --- Responsive ---------------------------------------------------------- */
@media (max-width: 980px) {
    .netpanel-grid { grid-template-columns: 1fr; }
    .np-col { border-right: none; border-bottom: 1px solid var(--border); }
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
    .metrics { grid-template-columns: repeat(2, 1fr); }
    .nav-links { display: none; }
    .nav-toggle { display: inline-grid; }
    .hide-mobile { display: none !important; }
    .kv-row { grid-template-columns: 1fr; gap: 3px; }
}
@media (max-width: 560px) {
    .container { padding: 0 14px; }
    .topbar .ticker { gap: 14px; }
    .topbar .container { font-size: 12px; }
    .topbar .dim { display: none; } /* hide Fee / Chain ID — still shown in the netpanel */
    .np-spark { display: none; }
    .metrics { grid-template-columns: 1fr; }
    .page-head { gap: 10px; }
}
