:root {
  --bg: #0a0a14;
  --panel: #12122a;
  --panel-2: #0f0f22;
  --line: #1e1e3a;
  --line-2: #2a2a4a;
  --text: #e0e0e0;
  --muted: #8b8ba3;
  --dim: #5c5c72;
  --purple: #a78bfa;
  --purple-2: #7c3aed;
  --green: #10b981;
  --red: #ef4444;
  --orange: #fb923c;
  --yellow: #fbbf24;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { min-height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Microsoft YaHei", sans-serif;
  background: radial-gradient(1200px 600px at 50% -20%, #171735 0%, var(--bg) 55%);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}

nav {
  background: rgba(18, 18, 42, .92);
  border-bottom: 1px solid var(--line);
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 6px;
  height: 56px;
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(10px);
}
nav .brand { font-weight: 800; font-size: 16px; color: var(--purple); margin-right: 18px; letter-spacing: -.01em; }
nav a { color: #a0a0b8; text-decoration: none; padding: 8px 14px; border-radius: 7px; font-size: 14px; }
nav a:hover, nav a.active { background: var(--line); color: var(--purple); }
nav .nav-right { margin-left: auto; display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--dim); }
.asset-switch { display: flex; gap: 4px; margin-left: 10px; }
.asset-switch a { padding: 5px 11px; border: 1px solid var(--line); border-radius: 999px; font-size: 11px; font-weight: 700; color: var(--muted); letter-spacing: .04em; }
.asset-switch a:hover { border-color: var(--purple-2); color: var(--purple); }
.asset-switch a.active { background: var(--purple-2); border-color: var(--purple-2); color: #fff; }
nav .nav-login { padding: 6px 12px; }
.link-btn { background: none; border: none; color: #a0a0b8; font: inherit; font-size: 12px; cursor: pointer; padding: 6px 8px; border-radius: 6px; }
.link-btn:hover { background: var(--line); color: var(--purple); }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); animation: pulse 2s infinite; display: inline-block; }
.live-dot.offline { background: var(--red); animation: none; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }

.container { max-width: 1220px; margin: 0 auto; padding: 24px; }
footer { text-align: center; color: #4b4b60; font-size: 12px; padding: 16px 0 40px; }

.mono { font-variant-numeric: tabular-nums; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.small { font-size: 12px; }
.muted { color: var(--muted); }
.dim { color: var(--dim); }
.green { color: var(--green); }
.red { color: var(--red); }
.purple { color: var(--purple); }
.orange { color: var(--orange); }

.stats-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat-card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 18px 20px; }
.stat-label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 8px; }
.stat-value { font-size: 26px; font-weight: 750; line-height: 1.2; }
.stat-value b { font-weight: 750; }
.stat-sub { font-size: 12px; color: var(--dim); margin-top: 5px; }

.section { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 20px; margin-bottom: 20px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.section h2 { font-size: 15px; font-weight: 650; color: #d6d6e6; display: flex; align-items: center; gap: 8px; }
.section-head a { color: var(--purple); text-decoration: none; }
.section-head a:hover { text-decoration: underline; }

.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); gap: 20px; }
.grid-2 .section { margin-bottom: 20px; }

.badges { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.badge { font-size: 11px; padding: 3px 9px; border-radius: 999px; font-weight: 650; white-space: nowrap; }
.badge.pass { background: #064e3b; color: #34d399; }
.badge.fail { background: #450a0a; color: #f87171; }
.badge.pending { background: #3a2f10; color: var(--yellow); }
.badge.info { background: #1e1b4b; color: var(--purple); }
.market-link { font-size: 12px; color: var(--purple); text-decoration: none; padding: 2px 8px; border: 1px solid var(--line-2); border-radius: 999px; }
.market-link:hover { border-color: var(--purple-2); }
.market-link.disabled { color: var(--dim); border-color: var(--line); pointer-events: none; }

.alert { border-radius: 9px; padding: 12px 16px; margin-bottom: 18px; font-size: 13px; line-height: 1.6; }
.alert.warn { background: #3a1d10; border: 1px solid #7c2d12; color: #fdba74; }
.alert.info { background: #101a2e; border: 1px solid #1e3a5f; color: #93c5fd; }
.alert.ok { background: #062e22; border: 1px solid #065f46; color: #6ee7b7; }

.price-bar-wrap { margin: 16px 0 14px; }
.price-bar-label { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.price-bar-label b { color: #d6d6e6; }
.price-bar { height: 10px; border-radius: 6px; overflow: hidden; display: flex; background: var(--panel-2); }
.bar-up { background: linear-gradient(90deg, #10b981, #059669); transition: width .5s ease; }
.bar-down { background: linear-gradient(90deg, #ef4444, #dc2626); transition: width .5s ease; }

.book-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.book-side { background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; }
.book-side.up { border-left: 3px solid var(--green); }
.book-side.down { border-left: 3px solid var(--red); }
.book-head { font-size: 12px; font-weight: 700; margin-bottom: 8px; color: #d6d6e6; display: flex; justify-content: space-between; }
.book-row { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); padding: 3px 0; }
.book-row b { color: var(--text); font-variant-numeric: tabular-nums; }

.gate-row { display: flex; gap: 20px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.gate-row b { color: var(--text); font-weight: 600; }
.gate-row small { color: var(--dim); }

.preview-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-top: 14px; }
.kv { background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; display: flex; flex-direction: column; gap: 4px; }
.kv span { font-size: 11px; color: var(--muted); }
.kv b { font-size: 14px; font-variant-numeric: tabular-nums; font-weight: 600; }
.kv-list { display: flex; flex-direction: column; gap: 2px; }
.kv-list .kv { flex-direction: row; justify-content: space-between; align-items: center; background: transparent; border: none; border-bottom: 1px solid #171730; border-radius: 0; padding: 8px 0; }
.kv-list .kv:last-child { border-bottom: none; }
.reason-line { margin-top: 12px; font-size: 13px; color: var(--muted); }
.params-line { margin-top: 6px; font-size: 11px; color: var(--dim); font-family: ui-monospace, SFMono-Regular, monospace; word-break: break-all; }

.mini-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); gap: 10px; }
.mini-grid.wide { margin-bottom: 20px; }
.mini { background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 12px; display: flex; flex-direction: column; gap: 4px; }
.mini span { font-size: 11px; color: var(--muted); }
.mini b { font-size: 18px; font-variant-numeric: tabular-nums; }
.latest-report { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 4px; }
.latest-report a { color: var(--purple); text-decoration: none; font-weight: 600; }
.latest-report a:hover { text-decoration: underline; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; color: var(--muted); font-weight: 500; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 9px 10px; border-bottom: 1px solid #171730; color: #c9c9d6; vertical-align: top; }
tr:last-child td { border-bottom: none; }
td a { color: var(--purple); text-decoration: none; }
td a:hover { text-decoration: underline; }
.empty { color: var(--dim); text-align: center; padding: 28px 10px; font-size: 13px; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h1 { font-size: 23px; font-weight: 750; letter-spacing: -.01em; }
.page-sub { font-size: 12px; color: var(--muted); margin-top: 5px; }
.head-actions { display: flex; align-items: center; gap: 10px; }

button.btn, a.btn { border: none; border-radius: 8px; padding: 9px 16px; font-size: 13px; font-weight: 600; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px; transition: filter .15s, opacity .15s; }
button.btn:hover, a.btn:hover { filter: brightness(1.12); }
button.btn:disabled { opacity: .45; cursor: default; filter: none; }
.btn-primary { background: var(--purple-2); color: #fff; }
.btn-ghost { background: var(--line); color: #b9b9cc; }

.log { background: #080812; border: 1px solid var(--line); border-radius: 8px; padding: 12px; font-size: 11px; color: #9a9ab0; max-height: 220px; overflow: auto; white-space: pre-wrap; word-break: break-word; margin-top: 12px; }

.checklist { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.checklist li { display: flex; align-items: center; gap: 10px; font-size: 13px; color: #c9c9d6; padding: 9px 12px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; }
.checklist li b { margin-left: auto; color: var(--muted); font-variant-numeric: tabular-nums; }
.checklist .check { width: 18px; height: 18px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 800; flex: none; }
.checklist li.ok .check { background: #064e3b; color: #34d399; }
.checklist li.bad .check { background: #450a0a; color: #f87171; }

/* Markdown report */
.markdown { line-height: 1.7; overflow-x: auto; }
.markdown h1 { font-size: 22px; margin: 6px 0 14px; }
.markdown h2 { font-size: 17px; margin: 26px 0 10px; padding-top: 8px; border-top: 1px solid var(--line); }
.markdown h3 { font-size: 14px; margin: 18px 0 8px; color: var(--purple); }
.markdown p { margin: 8px 0; color: #c9c9d6; }
.markdown table { margin: 12px 0 18px; font-size: 12px; }
.markdown th { background: #171730; }
.markdown td { padding: 7px 9px; }
.markdown code { background: #1c1c34; border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px; font-size: 12px; color: #d8c7ff; }
.markdown pre { background: #080812; border: 1px solid var(--line); border-radius: 8px; padding: 12px; overflow: auto; margin: 10px 0; }
.markdown pre code { background: transparent; border: none; padding: 0; color: #c9c9d6; }
.markdown blockquote { border-left: 3px solid var(--purple-2); background: #16162e; padding: 10px 14px; margin: 12px 0; color: #b9b9cc; border-radius: 0 8px 8px 0; }
.markdown ul, .markdown ol { margin: 8px 0 12px 22px; color: #c9c9d6; }
.markdown li { margin: 3px 0; }
.markdown a { color: var(--purple); }
.markdown hr { border: none; border-top: 1px solid var(--line); margin: 18px 0; }

/* Login */
.login-wrap { min-height: calc(100vh - 160px); display: flex; align-items: center; justify-content: center; padding: 24px; }
.login-card { width: 100%; max-width: 390px; background: var(--panel); border: 1px solid var(--line-2); border-radius: 14px; padding: 28px; box-shadow: 0 24px 70px rgba(0,0,0,.5); }
.login-brand { font-size: 22px; font-weight: 800; color: var(--purple); }
.login-sub { font-size: 12px; color: var(--muted); margin: 4px 0 20px; }
.login-field { display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--muted); margin-bottom: 14px; }
.login-field input { background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 8px; color: var(--text); padding: 10px 12px; font-size: 14px; }
.login-field input:focus { outline: none; border-color: var(--purple-2); box-shadow: 0 0 0 3px rgba(124,58,237,.15); }
.login-btn { width: 100%; margin-top: 8px; }
.login-error { color: #f87171; font-size: 12px; margin-top: 10px; min-height: 16px; }
.login-foot { text-align: center; margin-top: 16px; }

@media (max-width: 720px) {
  nav { padding: 0 12px; overflow-x: auto; }
  nav .brand { margin-right: 8px; }
  nav a { padding: 8px 10px; font-size: 13px; }
  .container { padding: 16px; }
  .book-grid { grid-template-columns: 1fr; }
  .stat-value { font-size: 22px; }
}
