:root {
  --bg: #0a0e13;
  --panel: #10171f;
  --panel-2: #141d27;
  --line: #1d2a38;
  --line-2: #263647;
  --text: #e7eef6;
  --muted: #8b9cb0;
  --faint: #5d6d7e;
  --green: #3ddc97;
  --blue: #66a3ff;
  --amber: #f6b756;
  --red: #ff6b6b;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background:
    radial-gradient(1200px 600px at 15% -10%, rgba(61, 220, 151, 0.08), transparent 60%),
    radial-gradient(900px 500px at 90% 0%, rgba(102, 163, 255, 0.07), transparent 55%),
    var(--bg);
  color: var(--text);
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}

.mono { font-family: var(--mono); font-size: 12.5px; letter-spacing: 0.01em; }
.muted { color: var(--muted); }

/* ---------------------------------------------------------------- top bar */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 22px;
  background: rgba(10, 14, 19, 0.82);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.brand { display: flex; align-items: center; gap: 10px; }
.brand-name { font-weight: 650; letter-spacing: 0.02em; font-size: 15px; }
.brand-sub { color: var(--muted); font-size: 12px; padding-left: 10px; border-left: 1px solid var(--line-2); }

.pulse {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 0 rgba(61, 220, 151, 0.6);
  animation: pulse 2.2s infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(61, 220, 151, 0.55); }
  70% { box-shadow: 0 0 0 8px rgba(61, 220, 151, 0); }
  100% { box-shadow: 0 0 0 0 rgba(61, 220, 151, 0); }
}

.top-actions { display: flex; align-items: center; gap: 10px; }

.chip {
  font-size: 12px;
  color: var(--muted);
  border: 1px solid var(--line-2);
  background: var(--panel);
  padding: 6px 10px;
  border-radius: 999px;
  white-space: nowrap;
}
.chip.ok { color: var(--green); border-color: rgba(61, 220, 151, 0.4); }
.chip.warn { color: var(--amber); border-color: rgba(246, 183, 86, 0.4); }

.btn {
  appearance: none;
  border: 1px solid rgba(61, 220, 151, 0.35);
  background: linear-gradient(180deg, rgba(61, 220, 151, 0.18), rgba(61, 220, 151, 0.08));
  color: var(--green);
  padding: 7px 13px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.06s ease, filter 0.15s ease;
}
.btn:hover { filter: brightness(1.15); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.ghost { background: transparent; border-color: var(--line-2); color: var(--muted); }
.btn.ghost:hover { color: var(--text); border-color: var(--faint); }

/* ---------------------------------------------------------------- layout */

main { padding: 18px 22px 40px; max-width: 1680px; margin: 0 auto; }

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

.card {
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
  min-height: 78px;
}
.card .k { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; }
.card .v { font-size: 26px; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; }
.card .s { color: var(--faint); font-size: 12px; margin-top: 2px; }
.card.green .v { color: var(--green); }
.card.blue .v { color: var(--blue); }
.card.amber .v { color: var(--amber); }

.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.search {
  flex: 1 1 320px;
  min-width: 240px;
  background: var(--panel);
  border: 1px solid var(--line-2);
  color: var(--text);
  border-radius: 9px;
  padding: 9px 12px;
  font-size: 13px;
  outline: none;
}
.search:focus { border-color: rgba(102, 163, 255, 0.55); box-shadow: 0 0 0 3px rgba(102, 163, 255, 0.1); }
.search::placeholder { color: var(--faint); }

.seg { display: inline-flex; background: var(--panel); border: 1px solid var(--line-2); border-radius: 9px; overflow: hidden; }
.seg button {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 12.5px;
  padding: 8px 11px;
  cursor: pointer;
  border-right: 1px solid var(--line);
}
.seg button:last-child { border-right: 0; }
.seg button:hover { color: var(--text); }
.seg button.active { background: rgba(102, 163, 255, 0.14); color: var(--blue); }

.sort { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12.5px; }
.sort select {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--line-2);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 12.5px;
  outline: none;
}

.count { margin-left: auto; color: var(--faint); font-size: 12.5px; }

/* ---------------------------------------------------------------- table */

.table-wrap {
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: auto;
  background: rgba(16, 23, 31, 0.6);
  max-height: calc(100vh - 250px);
}

table { width: 100%; border-collapse: collapse; white-space: nowrap; }

thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #0d141b;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  text-align: left;
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
}
thead th.num { text-align: right; }

tbody td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(29, 42, 56, 0.65);
  font-size: 13px;
}
tbody td.num { text-align: right; font-variant-numeric: tabular-nums; }
tbody tr { cursor: pointer; }
tbody tr:hover { background: rgba(102, 163, 255, 0.06); }
tbody tr:last-child td { border-bottom: 0; }

.addr { display: inline-flex; align-items: center; gap: 6px; }
.copy {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--faint);
  cursor: pointer;
  padding: 2px 3px;
  border-radius: 4px;
  font-size: 12px;
}
.copy:hover { color: var(--text); background: var(--line); }

.badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 650;
  padding: 2px 7px;
  border-radius: 999px;
  border: 1px solid transparent;
  letter-spacing: 0.02em;
}
.badge.high { color: var(--green); background: rgba(61, 220, 151, 0.1); border-color: rgba(61, 220, 151, 0.3); }
.badge.medium { color: var(--amber); background: rgba(246, 183, 86, 0.1); border-color: rgba(246, 183, 86, 0.3); }
.badge.low { color: var(--red); background: rgba(255, 107, 107, 0.09); border-color: rgba(255, 107, 107, 0.28); }
.badge.pending { color: var(--faint); background: rgba(139, 156, 176, 0.08); border-color: var(--line-2); }
.badge.bot { color: var(--blue); background: rgba(102, 163, 255, 0.09); border-color: rgba(102, 163, 255, 0.25); font-family: var(--mono); }

.bar {
  display: inline-block;
  width: 58px;
  height: 5px;
  border-radius: 3px;
  background: var(--line);
  margin-right: 8px;
  vertical-align: middle;
  overflow: hidden;
}
.bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--blue), var(--green)); border-radius: 3px; }

.score { font-weight: 650; color: var(--text); }
.up { color: var(--green); }
.dash { color: var(--faint); }

/* ---------------------------------------------------------------- drawer */

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(720px, 94vw);
  background: #0c1219;
  border-left: 1px solid var(--line-2);
  box-shadow: -30px 0 60px rgba(0, 0, 0, 0.45);
  transform: translateX(102%);
  transition: transform 0.22s ease;
  z-index: 40;
  display: flex;
  flex-direction: column;
}
.drawer.open { transform: translateX(0); }

.drawer-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}
.drawer-kicker { color: var(--faint); font-size: 10.5px; letter-spacing: 0.14em; }
.drawer-title { font-size: 14px; margin-top: 5px; word-break: break-all; }

.drawer-body { padding: 18px 20px 40px; overflow: auto; }

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}
.detail-grid .item {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
}
.detail-grid .k { color: var(--faint); font-size: 11px; text-transform: uppercase; letter-spacing: 0.07em; }
.detail-grid .v { margin-top: 4px; font-size: 15px; font-weight: 650; font-variant-numeric: tabular-nums; }

.hero {
  border: 1px solid rgba(61, 220, 151, 0.28);
  background: linear-gradient(180deg, rgba(61, 220, 151, 0.09), rgba(61, 220, 151, 0.02));
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 18px;
}
.hero .k { color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.08em; }
.hero .addrline { margin: 8px 0 12px; font-size: 15px; word-break: break-all; }
.hero .metrics { display: flex; flex-wrap: wrap; gap: 18px; }
.hero .metric .k { font-size: 10.5px; }
.hero .metric .v { font-size: 15px; font-weight: 650; margin-top: 2px; }

.section-title {
  font-size: 11.5px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 22px 0 10px;
}

.mini-table { width: 100%; border-collapse: collapse; }
.mini-table th {
  text-align: left;
  font-size: 10.5px;
  color: var(--faint);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 7px 8px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.mini-table th.num, .mini-table td.num { text-align: right; }
.mini-table td {
  padding: 8px;
  border-bottom: 1px solid rgba(29, 42, 56, 0.6);
  font-size: 12.5px;
  white-space: nowrap;
}
.mini-table td.mono { font-size: 12px; }
.mini-table tr.top td { background: rgba(61, 220, 151, 0.05); }

.note { color: var(--muted); font-size: 12.5px; line-height: 1.6; }
.note code { font-family: var(--mono); font-size: 11.5px; color: var(--blue); }

.empty { padding: 40px 10px; text-align: center; color: var(--faint); }

/* ---------------------------------------------------------------- toast */

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translate(-50%, 20px);
  background: #1a2532;
  border: 1px solid var(--line-2);
  color: var(--text);
  padding: 9px 16px;
  border-radius: 9px;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
  z-index: 60;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------------------------------------------------------------- responsive */

@media (max-width: 1100px) {
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .brand-sub { display: none; }
}
@media (max-width: 640px) {
  main { padding: 14px; }
  .topbar { padding: 12px 14px; }
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .top-actions .chip { display: none; }
  .table-wrap { max-height: none; }
}
