:root {
  color-scheme: dark;
  --bg: #111315;
  --surface: #181b1e;
  --surface-2: #202428;
  --surface-3: #252a2f;
  --line: #343a40;
  --line-soft: #2a2f34;
  --text: #f1f3f4;
  --muted: #9aa2a9;
  --subtle: #6f777e;
  --accent: #8fa3a2;
  --accent-strong: #b7c9c5;
  --peak: #c5a56b;
  --current: #8aa899;
  --danger: #b87b7b;
  --shadow: 0 12px 28px rgba(0, 0, 0, .32);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; min-height: 100vh; background: var(--bg); color: var(--text); }
button, a, input { font: inherit; }
svg { display: block; }

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-rows: 96px 1fr 44px;
  background: radial-gradient(circle at 50% -10%, #272b2f 0, #111315 42%, #0d0f10 100%);
}

.topbar {
  display: grid;
  grid-template-columns: 300px minmax(300px, 1fr) 300px;
  align-items: center;
  gap: 22px;
  padding: 0 24px 0 8px;
  border-bottom: 1px solid var(--line-soft);
  background: rgba(24, 27, 30, .96);
}

.brand { display: flex; align-items: center; text-decoration: none; min-width: 0; }
.brand img { width: 300px; max-height: 72px; object-fit: contain; filter: saturate(.25) contrast(1.08); }

.top-tabs { display: flex; align-items: center; gap: 6px; justify-self: center; padding: 4px; border: 1px solid var(--line-soft); border-radius: 7px; background: #131618; }
.top-tabs a { min-width: 86px; padding: 8px 12px; border-radius: 5px; color: var(--muted); text-align: center; text-decoration: none; font-size: 13px; font-weight: 600; }
.top-tabs a.active { color: var(--text); background: var(--surface-3); box-shadow: inset 0 0 0 1px #3d444a; }


.toolbar { width: 300px; display: flex; align-items: center; justify-content: flex-end; gap: 12px; min-width: 0; justify-self: end; }
.search-pill { width: 280px; height: 36px; padding: 0 12px; display: flex; align-items: center; gap: 10px; border: 1px solid var(--line-soft); border-radius: 6px; color: var(--muted); background: #111315; }
.search-pill svg, .icon-button svg { width: 18px; height: 18px; stroke: currentColor; stroke-width: 1.7; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.search-pill input { width: 100%; min-width: 0; border: 0; outline: 0; color: var(--text); background: transparent; font-size: 13px; }
.search-pill input::placeholder { color: #737b82; }
.sync-status { width: 218px; display: grid; gap: 2px; padding: 6px 8px; border: 1px solid transparent; border-radius: 6px; color: var(--muted); text-align: right; text-decoration: none; font-size: 11px; white-space: nowrap; overflow: hidden; transition: border-color .18s ease, background .18s ease, color .18s ease; }
.sync-status span, .sync-status strong { overflow: hidden; text-overflow: ellipsis; }
.sync-status strong { color: var(--text); font-size: 12px; font-weight: 600; }
.sync-status:hover, .sync-status:focus-visible { border-color: var(--line-soft); background: #15181a; color: var(--accent-strong); outline: none; }
.icon-button { width: 34px; height: 34px; display: grid; place-items: center; border: 1px solid var(--line-soft); border-radius: 6px; color: var(--muted); background: #15181a; cursor: pointer; }
.icon-button:disabled { cursor: wait; opacity: .78; }
.icon-button.is-loading svg { animation: spin .8s linear infinite; transform-box: fill-box; transform-origin: center; }
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

.dashboard { padding: 24px 34px 28px; overflow: auto; }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 18px; align-items: stretch; margin-bottom: 14px; }
.hero-copy, .brief-panel, .kpi-strip article, .chart-panel, .insight-stack article, .table-panel, .feed-panel { border: 1px solid var(--line-soft); background: rgba(24, 27, 30, .92); box-shadow: var(--shadow); }
.hero-copy { padding: 18px 20px; }
.eyebrow { display: block; margin-bottom: 6px; color: var(--accent-strong); font-size: 11px; font-weight: 700; letter-spacing: 0; text-transform: uppercase; }
.hero-copy h1 { margin: 0; max-width: 760px; font-size: 24px; font-weight: 560; line-height: 1.22; }
.hero-copy p { margin: 8px 0 0; max-width: 780px; color: var(--muted); font-size: 13px; line-height: 1.45; }
.brief-panel { padding: 16px; display: grid; align-content: center; gap: 6px; }
.brief-panel span, .kpi-strip span, .insight-stack span { color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; }
.brief-panel strong { font-size: 17px; font-weight: 650; }
.brief-panel p, .insight-stack p { margin: 0; color: var(--subtle); font-size: 12px; line-height: 1.45; }

.kpi-strip { display: grid; grid-template-columns: repeat(6, minmax(130px, 1fr)); gap: 10px; margin-bottom: 14px; }
.kpi-strip article { padding: 13px 14px; display: grid; gap: 5px; min-height: 82px; }
.kpi-strip strong { font-size: 19px; font-weight: 650; }
.kpi-strip small { color: var(--subtle); font-size: 11px; font-weight: 600; }

.analysis-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 14px; }
.kpi-strip-three { grid-template-columns: repeat(3, minmax(180px, 1fr)); }
.kpi-strip-four { grid-template-columns: repeat(4, minmax(160px, 1fr)); }
.overview-analysis { grid-template-columns: 1fr; }
.overview-chart { min-height: 300px; }
.page-heading { margin-bottom: 14px; padding: 18px 20px; border: 1px solid var(--line-soft); background: rgba(24, 27, 30, .92); box-shadow: var(--shadow); }
.page-heading h1 { margin: 0; font-size: 24px; font-weight: 560; line-height: 1.22; }
.page-heading p { margin: 8px 0 0; max-width: 760px; color: var(--muted); font-size: 13px; line-height: 1.45; }
.single-column { grid-template-columns: 1fr; }
.transaction-layout { grid-template-columns: 300px minmax(0, 1fr); align-items: start; }

.info-grid { display: grid; grid-template-columns: repeat(3, minmax(220px, 1fr)); gap: 14px; }
.info-card { padding: 18px 20px; display: grid; align-content: start; gap: 10px; border: 1px solid var(--line-soft); background: rgba(24, 27, 30, .92); box-shadow: var(--shadow); }
.info-card span { color: var(--accent-strong); font-size: 11px; font-weight: 700; text-transform: uppercase; }
.info-card h2 { margin: 0; font-size: 18px; font-weight: 650; }
.info-card p { margin: 0 0 4px; color: var(--muted); font-size: 13px; line-height: 1.45; }
.info-card .text-button { justify-self: start; }

.fees-grid { display: grid; grid-template-columns: minmax(280px, .7fr) minmax(0, 1.3fr); gap: 14px; }
.fees-panel { align-content: start; }
.fees-form { display: grid; gap: 9px; }
.fees-form label { color: var(--subtle); font-size: 11px; font-weight: 700; text-transform: uppercase; }
.fees-control-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: center; }
.fees-control-row input { min-width: 0; height: 34px; padding: 0 10px; border: 1px solid var(--line-soft); border-radius: 5px; color: var(--text); background: #111315; font-family: "SFMono-Regular", Consolas, monospace; font-size: 12px; }
.fees-control-row input:focus { border-color: #5c646a; outline: none; }
.fees-result { margin: 0; display: grid; gap: 9px; }
.fees-result div { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 10px; align-items: baseline; }
.fees-result dt { color: var(--subtle); font-size: 11px; font-weight: 700; text-transform: uppercase; }
.fees-result dd { margin: 0; color: var(--text); font-size: 13px; font-weight: 650; min-width: 0; }
.fees-hash-list { max-height: 260px; margin: 14px 0 0; padding: 0; overflow: auto; display: grid; gap: 6px; list-style: none; }
.fees-hash-list li { min-width: 0; padding: 8px 10px; border: 1px solid var(--line-soft); background: #111315; color: var(--muted); font-size: 11px; }
.fees-hash-list code { display: block; overflow-wrap: anywhere; font-family: "SFMono-Regular", Consolas, monospace; }
.fees-hash-more { color: var(--subtle); font-weight: 700; text-transform: uppercase; }
.fees-output-label { margin-top: 14px; color: var(--subtle); font-size: 11px; font-weight: 700; text-transform: uppercase; }
.fees-json { min-height: 160px; max-height: 340px; margin: 14px 0 0; overflow: auto; padding: 12px; border: 1px solid var(--line-soft); background: #111315; color: var(--muted); font-family: "SFMono-Regular", Consolas, monospace; font-size: 11px; line-height: 1.45; }

.chart-panel { padding: 18px 20px; }
.panel-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.panel-header h2 { margin: 0; font-size: 17px; font-weight: 650; }
.panel-header span { color: var(--muted); font-size: 12px; font-weight: 600; }
.panel-header.compact { margin-bottom: 10px; }
.panel-header.compact h2 { font-size: 16px; }
.legend { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 12px; white-space: nowrap; }
.legend span { display: flex; align-items: center; gap: 7px; }
.legend i { width: 28px; height: 10px; border-radius: 3px; }
.volume-key { background: #757c82; }
.peak-key { background: var(--peak); }

.bar-chart { height: 230px; display: grid; grid-template-columns: repeat(12, minmax(44px, 1fr)); gap: 9px; align-items: end; overflow-x: auto; padding-top: 6px; }
.bar { height: 100%; min-width: 44px; display: grid; grid-template-rows: 20px 1fr 18px; gap: 5px; align-items: end; color: var(--muted); text-align: center; font-weight: 600; }
.bar span, .bar b { font-size: 11px; }
.bar i { width: 100%; height: calc(var(--value) * 1%); min-height: 5px; align-self: end; border-radius: 4px 4px 0 0; background: linear-gradient(180deg, #8c9398, #565d62); }
.bar.peak i { background: linear-gradient(180deg, #d0b881, #8d7442); }
.bar.current i { background: linear-gradient(180deg, #9bb9a9, #657d71); }

.insight-stack { display: grid; gap: 10px; }
.insight-stack article { padding: 15px; display: grid; gap: 7px; }
.insight-stack strong { font-size: 16px; font-weight: 650; }
.meter { height: 20px; position: relative; overflow: hidden; border-radius: 4px; background: #111315; border: 1px solid var(--line-soft); }
.meter i { position: absolute; inset: 0 auto 0 0; background: linear-gradient(90deg, #65736d, #9bb9a9); }
.meter b { position: relative; z-index: 1; display: grid; place-items: center; height: 100%; color: var(--text); font-size: 11px; }

.data-grid { margin-top: 14px; display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(320px, .9fr); gap: 14px; }
.data-grid.single-column { grid-template-columns: 1fr; }
.validators-tables { gap: 14px; }
.table-panel, .feed-panel { padding: 16px; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 8px 9px; border-bottom: 1px solid var(--line-soft); text-align: left; }
th { color: var(--subtle); font-size: 11px; text-transform: uppercase; letter-spacing: 0; }
.sort-button { display: inline-flex; align-items: center; gap: 6px; padding: 0; border: 0; color: inherit; background: transparent; font: inherit; text-transform: inherit; cursor: pointer; }
.sort-button::after { content: ""; width: 0; height: 0; border-left: 4px solid transparent; border-right: 4px solid transparent; opacity: .35; }
.sort-button[data-sort-direction="asc"]::after { border-bottom: 5px solid currentColor; opacity: .9; }
.sort-button[data-sort-direction="desc"]::after { border-top: 5px solid currentColor; opacity: .9; }
.sort-button:hover, .sort-button:focus-visible { color: var(--text); }
td { color: var(--text); font-size: 12px; font-weight: 600; }
td:nth-child(2), td:nth-child(3) { white-space: nowrap; }
code { color: var(--accent-strong); display: block; max-width: 100%; font-family: "SFMono-Regular", Consolas, monospace; font-size: 11px; line-height: 1.45; white-space: normal; overflow-wrap: anywhere; word-break: break-all; }
.validator-identity { display: grid; grid-template-columns: 32px minmax(0, 1fr); align-items: center; gap: 10px; min-width: 360px; }
.validator-status { width: 32px; height: 32px; border-radius: 8px; object-fit: cover; box-shadow: 0 0 0 1px var(--line-soft); }
.address-link, .hash-link { min-width: 0; color: inherit; text-decoration: none; }
.address-link:hover code, .address-link:focus-visible code, .hash-link:hover code, .hash-link:focus-visible code, code .hash-link:hover, code .hash-link:focus-visible { color: var(--text); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
tr[hidden] { display: none; }

.transactions-table { min-width: 920px; }
.transactions-table th:first-child, .transactions-table td:first-child { width: 150px; white-space: nowrap; }
.transactions-table th:nth-child(3), .transactions-table td:nth-child(3) { width: 190px; }
.transactions-table time { color: var(--muted); font-size: 12px; font-weight: 600; white-space: nowrap; }

.footer-bar { min-height: 44px; padding: 0 34px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px; color: var(--muted); border-top: 1px solid var(--line-soft); background: #151719; font-size: 12px; font-weight: 600; }
.footer-bar > span:last-child, .footer-link { justify-self: end; }
.footer-link { color: var(--muted); text-decoration: none; }
.footer-link:hover, .footer-link:focus-visible { color: var(--text); text-decoration: underline; text-underline-offset: 3px; outline: none; }
.x-link { width: 28px; height: 28px; display: grid; place-items: center; border: 1px solid var(--line-soft); border-radius: 50%; color: #fff; background: #101214; text-decoration: none; transition: border-color .18s ease, color .18s ease, background .18s ease; }
.x-link:hover { color: #fff; border-color: #5c646a; background: #181b1e; }
.x-link img { width: 13px; height: 13px; object-fit: contain; }
.footer-bar b { color: var(--text); font-size: 13px; }
.footer-bar mark { margin-left: 6px; padding: 3px 8px; border-radius: 4px; color: #101211; background: var(--accent-strong); }

.validator-page-shell { grid-template-rows: 96px 1fr 44px; }
.validator-detail-hero { margin-bottom: 14px; padding: 18px 20px; display: grid; grid-template-columns: 86px minmax(0, 1fr); align-items: center; gap: 18px; border: 1px solid var(--line-soft); background: rgba(24, 27, 30, .92); box-shadow: var(--shadow); }
.validator-detail-hero img { width: 86px; height: 86px; border-radius: 14px; object-fit: cover; box-shadow: 0 0 0 1px var(--line-soft); }
.validator-detail-hero h1 { margin: 0 0 8px; font-size: 24px; font-weight: 560; line-height: 1.22; }
.validator-detail-hero code { margin-bottom: 8px; }
.validator-detail-hero p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.45; }
.detail-actions { margin-top: 12px; display: flex; flex-wrap: wrap; gap: 8px; }
.text-button { display: inline-flex; align-items: center; min-height: 32px; padding: 0 11px; border: 1px solid var(--line-soft); border-radius: 5px; color: var(--text); background: #15181a; text-decoration: none; font-size: 12px; font-weight: 650; }
.text-button:hover, .text-button:focus-visible { border-color: #5c646a; background: #1c2023; outline: none; }
.validator-month-chart { grid-template-columns: repeat(12, minmax(44px, 1fr)); }
body[data-validator-found="false"] .validator-detail-hero img, body[data-validator-found="false"] .analysis-grid, body[data-validator-found="false"] .data-grid { opacity: .45; }

@media (max-width: 1260px) {
  .topbar { grid-template-columns: minmax(280px, 1fr); grid-template-areas: "brand" "toolbar" "tabs"; height: auto; min-height: 144px; padding: 12px 14px; }
  .brand { grid-area: brand; }
  .top-tabs { grid-area: tabs; justify-self: start; }
  .toolbar { grid-area: toolbar; width: auto; justify-self: end; }
  .sync-status { display: none; }
  .kpi-strip, .kpi-strip-three, .kpi-strip-four { grid-template-columns: repeat(3, 1fr); }
  .analysis-grid, .hero-grid, .data-grid, .transaction-layout, .info-grid, .fees-grid { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .app-shell { display: block; }
  .topbar { display: flex; flex-direction: column; align-items: stretch; gap: 12px; padding: 14px; }
  .brand { justify-content: flex-start; }
  .brand img { width: min(300px, 90vw); max-height: 72px; }
  .top-tabs { justify-content: center; overflow-x: auto; }
  .top-tabs a { min-width: auto; flex: 1; }
  .toolbar { width: 100%; justify-content: center; flex-wrap: wrap; }
  .icon-button { order: 3; }
  .search-pill { width: 100%; }
  .dashboard { padding: 16px 12px 26px; }
  .fees-control-row { grid-template-columns: 1fr; }
  .hero-copy h1 { font-size: 21px; }
  .kpi-strip, .kpi-strip-three, .kpi-strip-four { grid-template-columns: 1fr 1fr; }
  .bar-chart { height: 190px; }
  .panel-header { flex-direction: column; }
  .legend { flex-wrap: wrap; }
  .validator-detail-hero { grid-template-columns: 1fr; }
  .footer-bar { padding: 14px; min-height: 76px; grid-template-columns: 1fr; justify-items: start; }
  .footer-bar > span:last-child, .footer-link { justify-self: start; }
  .x-link { justify-self: start; }
}
