:root {
  color-scheme: light;
  --bg: #f5f7f9;
  --surface: #ffffff;
  --surface-2: #eef3f6;
  --text: #172026;
  --muted: #60717d;
  --line: #d8e0e5;
  --accent: #0f766e;
  --accent-2: #2563eb;
  --warn: #b45309;
  --bad: #b91c1c;
  --good: #047857;
  --shadow: 0 14px 34px rgba(23, 32, 38, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    linear-gradient(180deg, rgba(15, 118, 110, 0.10), rgba(37, 99, 235, 0.04) 290px, transparent 520px),
    var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input {
  font: inherit;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 14px clamp(16px, 4vw, 44px);
  border-bottom: 1px solid rgba(216, 224, 229, 0.82);
  background: rgba(245, 247, 249, 0.90);
  backdrop-filter: blur(14px);
}

.brand {
  display: flex;
  align-items: center;
  min-width: 0;
}

.brand-title {
  font-size: 17px;
  font-weight: 760;
  line-height: 1.15;
}

.brand-subtitle {
  max-width: min(52vw, 720px);
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-actions {
  display: flex;
  gap: 8px;
}

.nav-actions a {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--text);
  font-size: 13px;
  font-weight: 650;
  text-decoration: none;
}

.shell {
  width: min(1480px, 100%);
  margin: 0 auto;
  padding: 22px clamp(14px, 3vw, 34px) 44px;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.metric {
  min-height: 98px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.84);
  box-shadow: var(--shadow);
}

.metric-label {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 720;
  letter-spacing: 0;
  text-transform: uppercase;
}

.metric strong {
  display: block;
  margin-top: 12px;
  overflow-wrap: anywhere;
  font-size: clamp(24px, 3vw, 34px);
  line-height: 1;
}

.search-band {
  margin-top: 16px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.search-form {
  display: grid;
  gap: 12px;
}

.search-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 118px;
  gap: 10px;
}

.search-row input {
  width: 100%;
  min-height: 44px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #ffffff;
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 14px;
  outline: none;
}

.search-row input:focus {
  border-color: rgba(15, 118, 110, 0.66);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.14);
}

.search-row button {
  display: grid;
  place-items: center;
  min-height: 44px;
  border: 0;
  border-radius: 7px;
  background: var(--accent);
  color: #ffffff;
  cursor: pointer;
  font-weight: 760;
}

.status-line {
  min-height: 20px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.status-line.error {
  color: var(--bad);
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(420px, 560px);
  gap: 16px;
  margin-top: 16px;
  align-items: start;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.panel-header.compact {
  padding-bottom: 14px;
}

.panel h1,
.panel h2,
.panel p {
  margin: 0;
}

.panel h1 {
  font-size: 24px;
  line-height: 1.2;
}

.panel h2 {
  font-size: 18px;
  line-height: 1.25;
}

.panel p {
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
}

.details {
  padding: 18px;
}

.empty-state {
  padding: 28px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #fbfcfd;
  color: var(--muted);
}

.kv-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.kv {
  min-height: 74px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.kv span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 720;
  text-transform: uppercase;
}

.kv strong,
.kv code {
  display: block;
  margin-top: 8px;
  overflow-wrap: anywhere;
  color: var(--text);
  font-size: 14px;
  line-height: 1.45;
}

.kv code,
.hash,
.json-view {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.hash {
  overflow-wrap: anywhere;
  color: var(--accent-2);
  font-size: 12px;
  line-height: 1.35;
}

.block-list {
  display: grid;
  max-height: calc(100vh - 260px);
  overflow: auto;
  padding: 10px;
  gap: 8px;
}

.block-item {
  display: grid;
  gap: 7px;
  width: 100%;
  min-height: 112px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
  color: inherit;
  cursor: pointer;
  text-align: left;
}

.block-item:hover {
  border-color: rgba(15, 118, 110, 0.55);
}

.block-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.block-time {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: #e8f4f1;
  color: var(--accent);
  font-size: 12px;
  font-weight: 760;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 680px;
}

th,
td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  background: #f6f9fa;
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
  text-transform: uppercase;
}

tr:last-child td {
  border-bottom: 0;
}

.link-button {
  border: 0;
  background: transparent;
  color: var(--accent-2);
  cursor: pointer;
  padding: 0;
  text-align: left;
}

.kv-action {
  display: block;
  margin-top: 8px;
  font-size: 14px;
  line-height: 1.45;
}

.section-title {
  margin: 22px 0 10px;
  font-size: 15px;
}

.json-view {
  max-height: 520px;
  overflow: auto;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #101820;
  color: #e5eef4;
  font-size: 12px;
  line-height: 1.55;
  white-space: pre-wrap;
}

.state-good {
  color: var(--good);
}

.state-warn {
  color: var(--warn);
}

@media (max-width: 980px) {
  .summary-grid,
  .content-grid {
    grid-template-columns: 1fr;
  }

  .block-list {
    max-height: none;
  }
}

@media (max-width: 640px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .nav-actions {
    width: 100%;
  }

  .nav-actions a {
    flex: 1;
    justify-content: center;
  }

  .summary-grid,
  .kv-grid,
  .search-row {
    grid-template-columns: 1fr;
  }

  .panel-header {
    align-items: flex-start;
  }
}
