:root {
  --bg: #f5f7f9;
  --surface: #ffffff;
  --surface-subtle: #f9fafb;
  --text: #13232f;
  --muted: #657489;
  --border: #dde5eb;
  --accent: #087568;
  --accent-strong: #075f55;
  --green: #229a56;
  --amber: #d98716;
  --red: #cf3434;
  --slate: #0b3640;
  --shadow: 0 12px 30px rgba(35, 52, 68, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
}

.app-shell {
  display: grid;
  min-height: 100vh;
  grid-template-columns: 248px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  height: 100vh;
  flex-direction: column;
  padding: 22px 18px;
  background: linear-gradient(180deg, #073d43 0%, #082f38 100%);
  color: #eefafa;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 4px 24px;
}

.brand-mark {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
  font-weight: 800;
}

.brand strong,
.brand span {
  display: block;
}

.brand strong {
  font-size: 18px;
  line-height: 1.2;
}

.brand span {
  color: rgba(238, 250, 250, 0.68);
  font-size: 12px;
}

.nav-list {
  display: grid;
  gap: 6px;
}

.nav-item {
  border-radius: 7px;
  color: rgba(238, 250, 250, 0.74);
  padding: 12px 14px;
  text-decoration: none;
  transition: background 160ms ease, color 160ms ease;
}

.nav-item:hover,
.nav-item.active {
  background: rgba(255, 255, 255, 0.11);
  color: #ffffff;
}

.sidebar-footer {
  margin-top: auto;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  padding-top: 18px;
}

.tiny-label {
  display: block;
  color: rgba(238, 250, 250, 0.58);
  font-size: 12px;
}

.main {
  min-width: 0;
  padding: 26px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 24px;
  line-height: 1.25;
}

h2 {
  font-size: 17px;
  line-height: 1.3;
}

h3 {
  font-size: 14px;
  line-height: 1.3;
}

.topbar p,
.panel-header p,
.metric-meta {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.topbar-actions,
.filters,
.metric-value,
.status-row,
.actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.live-dot,
.status-dot {
  display: inline-block;
  flex: 0 0 auto;
  border-radius: 999px;
}

.live-dot {
  width: 9px;
  height: 9px;
  background: var(--green);
  box-shadow: 0 0 0 5px rgba(34, 154, 86, 0.12);
}

.status-dot {
  width: 10px;
  height: 10px;
  background: var(--muted);
}

.status-dot.ok {
  background: var(--green);
}

.status-dot.warn {
  background: var(--amber);
}

.status-dot.bad {
  background: var(--red);
}

.status-dot.muted {
  background: #9aa8b6;
}

.button {
  min-height: 38px;
  border: 0;
  border-radius: 7px;
  background: var(--accent);
  color: #ffffff;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  padding: 0 14px;
  transition: background 160ms ease, transform 160ms ease;
}

.button:hover {
  background: var(--accent-strong);
}

.button:active {
  transform: translateY(1px);
}

.button.secondary {
  border: 1px solid var(--border);
  background: #ffffff;
  color: var(--text);
}

.button.secondary:hover {
  background: var(--surface-subtle);
}

.button.link {
  min-height: auto;
  background: transparent;
  color: var(--accent);
  padding: 0;
}

.button.link:hover {
  background: transparent;
  color: var(--accent-strong);
}

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

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

.metric-card {
  min-height: 122px;
  padding: 18px;
}

.metric-label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.metric-value {
  margin-top: 14px;
  font-size: 28px;
  font-weight: 800;
  letter-spacing: 0;
}

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

.panel {
  overflow: hidden;
}

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

.panel-header.compact {
  display: block;
}

.filters {
  flex-wrap: wrap;
  justify-content: flex-end;
}

input,
select {
  min-height: 36px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: #ffffff;
  color: var(--text);
  font-size: 13px;
  padding: 0 12px;
  outline: none;
}

input:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(8, 117, 104, 0.12);
}

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

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

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

th {
  background: var(--surface-subtle);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

td {
  font-size: 13px;
}

.source-name {
  display: grid;
  gap: 3px;
}

.source-name strong {
  font-size: 13px;
}

.source-name span {
  color: var(--muted);
  font-size: 12px;
}

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

.badge.gray {
  background: #eef2f5;
  color: #5f6d7c;
}

.badge.red {
  background: #fff0f0;
  color: var(--red);
}

.badge.green {
  background: #ecf8f0;
  color: var(--green);
}

.actions {
  white-space: nowrap;
}

.empty-cell,
.empty-state {
  color: var(--muted);
  padding: 28px 18px;
  text-align: center;
}

.event-list {
  display: grid;
  max-height: 644px;
  overflow: auto;
}

.event-item {
  display: grid;
  gap: 7px;
  border-bottom: 1px solid var(--border);
  padding: 14px 18px;
}

.event-title-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
}

.event-title-button {
  border: 0;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.4;
  padding: 0;
  text-align: left;
}

.event-title-button:hover {
  color: var(--accent);
}

.event-title-button[aria-expanded="true"] {
  color: var(--accent-strong);
}

.event-open-link {
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
}

.event-open-link:hover {
  color: var(--accent-strong);
}

.event-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.event-detail {
  display: grid;
  gap: 8px;
  margin-top: 4px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface-subtle);
  padding: 10px;
}

.event-detail div {
  display: grid;
  gap: 2px;
}

.event-detail span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.event-detail strong {
  overflow-wrap: anywhere;
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.45;
}

.tools-panel {
  margin-top: 16px;
}

.tool-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  padding: 18px;
}

.tool-card {
  display: grid;
  gap: 12px;
  box-shadow: none;
  padding: 14px;
}

.api-output {
  min-height: 180px;
  max-height: 360px;
  overflow: auto;
  margin: 0 18px 18px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #0f1d26;
  color: #d9f7ef;
  font-size: 12px;
  line-height: 1.6;
  padding: 14px;
  white-space: pre-wrap;
}

.page-view {
  display: grid;
  gap: 16px;
}

.compact-list {
  max-height: 420px;
}

.feed-layout {
  display: grid;
  grid-template-columns: minmax(390px, 0.9fr) minmax(0, 1.1fr);
  min-height: 620px;
}

.feed-column {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-width: 0;
  border-right: 1px solid var(--border);
}

.feed-summary {
  border-bottom: 1px solid var(--border);
  background: var(--surface-subtle);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  padding: 10px 18px;
}

.feed-list {
  max-height: 720px;
  overflow: auto;
}

.feed-item {
  display: grid;
  gap: 9px;
  border-bottom: 1px solid var(--border);
  background: #ffffff;
  padding: 15px 18px;
  transition: background 140ms ease, box-shadow 140ms ease;
}

.feed-item:hover,
.feed-item.active {
  background: #f7fbfa;
}

.feed-item.active {
  box-shadow: inset 3px 0 0 var(--accent);
}

.feed-item-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.feed-title {
  border: 0;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font-size: 15px;
  font-weight: 800;
  line-height: 1.45;
  padding: 0;
  text-align: left;
}

.feed-title:hover {
  color: var(--accent);
}

.feed-item p,
.detail-header p,
.form-note {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.feed-item p {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.pagination {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr) 110px;
  gap: 12px;
  align-items: center;
  border-top: 1px solid var(--border);
  padding: 12px 18px;
}

.pagination span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  text-align: center;
}

.feed-detail-panel {
  min-width: 0;
  max-height: 780px;
  overflow: auto;
  padding: 18px;
}

.detail-header {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
}

.detail-source-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.readable-text {
  overflow-wrap: anywhere;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
  color: var(--text);
  font-size: 15px;
  line-height: 1.78;
  margin-bottom: 16px;
  padding: 16px;
  white-space: pre-wrap;
}

.detail-list {
  display: grid;
  gap: 10px;
  margin: 0 0 16px;
}

.detail-list div {
  display: grid;
  gap: 4px;
}

.detail-list dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.detail-list dd {
  min-width: 0;
  overflow-wrap: anywhere;
  margin: 0;
  font-size: 13px;
}

.detail-json {
  margin: 16px 0 0;
}

.raw-json-block {
  margin-top: 16px;
}

.raw-json-block summary {
  color: var(--accent);
  cursor: pointer;
  font-size: 13px;
  font-weight: 800;
}

.two-column {
  display: grid;
  grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.form-panel {
  display: grid;
  gap: 12px;
  padding-bottom: 18px;
}

.form-panel label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  padding: 0 18px;
}

.form-panel input,
.form-panel .button,
.form-note {
  margin: 0 18px;
}

.inline-form {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) 160px auto;
  gap: 12px;
  padding: 18px;
}

.config-list {
  display: grid;
}

.config-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 88px auto;
  gap: 12px;
  align-items: center;
  border-bottom: 1px solid var(--border);
  padding: 14px 18px;
}

.config-row div {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.config-row strong,
.config-row span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.config-row span {
  color: var(--muted);
  font-size: 12px;
}

.json-panels {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  padding: 18px;
}

.json-panels .api-output {
  margin: 0;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  display: none;
  max-width: 360px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--shadow);
  color: var(--text);
  font-size: 13px;
  padding: 12px 14px;
}

.toast.visible {
  display: block;
}

@media (max-width: 1180px) {
  .status-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .content-layout,
  .tool-grid,
  .feed-layout,
  .two-column,
  .json-panels {
    grid-template-columns: 1fr;
  }

  .feed-list {
    max-height: none;
    border-bottom: 1px solid var(--border);
  }

  .feed-column {
    border-right: 0;
  }
}

@media (max-width: 760px) {
  .app-shell {
    display: block;
  }

  .sidebar {
    position: static;
    height: auto;
  }

  .nav-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .main {
    padding: 18px;
  }

  .topbar,
  .panel-header {
    display: grid;
  }

  .topbar-actions,
  .filters {
    justify-content: flex-start;
  }

  .status-grid {
    grid-template-columns: 1fr;
  }

  input,
  select,
  .button {
    width: 100%;
  }

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

  .pagination {
    grid-template-columns: 1fr;
  }

  .pagination span {
    text-align: left;
  }
}

.hidden {
  display: none !important;
}

.login-screen {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
  background: linear-gradient(135deg, #eef4f5 0%, #f9fafb 42%, #e7f1ef 100%);
}

.login-panel {
  width: min(100%, 460px);
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--shadow);
  padding: 28px;
}

.login-brand {
  color: var(--text);
  padding: 0 0 22px;
}

.login-brand .brand-mark {
  border-color: var(--border);
  background: var(--slate);
  color: #ffffff;
}

.login-brand span {
  color: var(--muted);
}

.login-panel h1 {
  margin-bottom: 10px;
}

.login-panel p,
.login-hint {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.wallet-options {
  display: grid;
  gap: 10px;
  margin: 22px 0 12px;
}

.wallet-button {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 64px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
  color: var(--text);
  cursor: pointer;
  padding: 10px 12px;
  text-align: left;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.wallet-button:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(8, 117, 104, 0.1);
}

.wallet-button:active {
  transform: translateY(1px);
}

.wallet-button:disabled {
  cursor: wait;
  opacity: 0.68;
}

.wallet-button strong,
.wallet-button small {
  display: block;
}

.wallet-button strong {
  font-size: 14px;
}

.wallet-button small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.wallet-icon {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: 8px;
  color: #ffffff;
  font-size: 12px;
  font-weight: 900;
}

.wallet-icon.okx {
  background: #111111;
}

.wallet-icon.metamask {
  background: #e2761b;
}

.wallet-chip {
  max-width: 210px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: #ffffff;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  padding: 9px 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wallets-panel {
  margin-top: 16px;
}

.wallet-form {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(180px, 260px) auto;
  gap: 12px;
  padding: 18px;
  border-bottom: 1px solid var(--border);
}

.wallet-list {
  display: grid;
}

.wallet-row {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) 150px 130px 140px;
  gap: 14px;
  align-items: center;
  border-bottom: 1px solid var(--border);
  padding: 14px 18px;
}

.wallet-address {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.wallet-address strong,
.wallet-address span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wallet-address strong {
  font-size: 13px;
}

.wallet-address span,
.wallet-row time {
  color: var(--muted);
  font-size: 12px;
}

.wallet-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

@media (max-width: 760px) {
  .wallet-form,
  .wallet-row,
  .inline-form {
    grid-template-columns: 1fr;
  }

  .wallet-actions {
    justify-content: flex-start;
  }

  .wallet-chip {
    width: 100%;
    max-width: none;
  }
}
