/* ========== 全局 ========== */
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  background: #0e0e10;
  color: #f5f5f7;
  display: flex;
  min-height: 100vh;
}
button { cursor: pointer; font-family: inherit; }
input, select, button { font-size: 14px; }
.hidden { display: none !important; }
code {
  background: #1c1c1e;
  padding: 2px 6px;
  border-radius: 4px;
  color: #00d4ff;
  font-family: "Consolas", monospace;
  font-size: 12px;
}

/* ========== 侧边栏 ========== */
.sidebar {
  width: 220px;
  background: #1a1a1c;
  border-right: 1px solid #2a2a2c;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}
.logo {
  padding: 20px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid #2a2a2c;
}
.logo-icon {
  width: 40px; height: 40px;
  background: linear-gradient(135deg, #2a7fff, #00d4ff);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
}
.logo-title { font-weight: bold; font-size: 15px; }
.logo-sub { font-size: 11px; color: #86868b; margin-top: 2px; }

.nav { flex: 1; padding: 12px 8px; display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px;
  color: #86868b;
  text-decoration: none;
  border-radius: 8px;
  font-size: 14px;
  transition: all .2s;
}
.nav-item:hover { background: #2a2a2c; color: #f5f5f7; }
.nav-item.active { background: linear-gradient(90deg, rgba(42,127,255,.15), transparent); color: #2a7fff; }
.nav-ico { font-size: 18px; }

.sidebar-footer {
  padding: 16px;
  display: flex; align-items: center; gap: 8px;
  border-top: 1px solid #2a2a2c;
  color: #86868b; font-size: 13px;
}
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #666; }
.status-dot.online { background: #38ef7d; box-shadow: 0 0 6px #38ef7d; }
.status-dot.offline { background: #ff6b6b; }

/* ========== 主区域 ========== */
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }

.topbar {
  height: 56px;
  padding: 0 20px;
  display: flex; align-items: center; justify-content: space-between;
  background: #141416;
  border-bottom: 1px solid #2a2a2c;
  flex-shrink: 0;
}
.page-title { font-size: 16px; font-weight: 600; }
.topbar-right { display: flex; align-items: center; gap: 8px; }
.api-input {
  background: #1c1c1e;
  border: 1px solid #2a2a2c;
  color: #f5f5f7;
  padding: 8px 12px;
  border-radius: 6px;
  width: 200px;
  outline: none;
  transition: border-color .2s;
}
.api-input:focus { border-color: #2a7fff; }

/* ========== 按钮 ========== */
.btn {
  background: #1c1c1e;
  border: 1px solid #2a2a2c;
  color: #f5f5f7;
  padding: 8px 16px;
  border-radius: 6px;
  transition: all .2s;
  font-weight: 500;
}
.btn:hover { background: #2a2a2c; }
.btn-primary { background: linear-gradient(135deg, #2a7fff, #00d4ff); border: none; color: #fff; }
.btn-primary:hover { filter: brightness(1.1); }
.btn-ghost { background: transparent; border: none; font-size: 18px; }
.btn-ghost:hover { background: #2a2a2c; }

/* ========== 视图 ========== */
.view {
  padding: 20px;
  flex: 1;
  overflow-y: auto;
}

.card {
  background: #141416;
  border: 1px solid #2a2a2c;
  border-radius: 12px;
  padding: 18px;
  margin-bottom: 18px;
}
.card-head {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid #2a2a2c;
}
.flex-between { display: flex; justify-content: space-between; align-items: center; }

/* ========== KPI ========== */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 18px;
}
.kpi-card {
  background: #141416;
  border: 1px solid #2a2a2c;
  border-radius: 12px;
  padding: 18px;
  display: flex; align-items: center; gap: 14px;
}
.kpi-ico {
  width: 48px; height: 48px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
}
.kpi-num { font-size: 24px; font-weight: bold; color: #2a7fff; }
.kpi-label { font-size: 12px; color: #86868b; margin-top: 2px; }

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

/* ========== Chart ========== */
.chart { width: 100%; height: 280px; }

/* ========== Table ========== */
.table {
  width: 100%;
  border-collapse: collapse;
}
.table th, .table td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid #2a2a2c;
}
.table th {
  font-size: 12px;
  color: #86868b;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .5px;
}
.table tbody tr:hover { background: #1c1c1e; }
.table tbody tr:last-child td { border-bottom: none; }
.tag {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 12px;
}
.tag-stranger { background: rgba(255,107,107,.15); color: #ff6b6b; }
.tag-known { background: rgba(56,239,125,.15); color: #38ef7d; }
.tag-mask { background: rgba(247,151,30,.15); color: #f7971e; }

/* ========== Persons ========== */
.persons-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
}
.person-card {
  background: #1c1c1e;
  border: 1px solid #2a2a2c;
  border-radius: 10px;
  padding: 14px;
  text-align: center;
  transition: all .2s;
}
.person-card:hover { border-color: #2a7fff; transform: translateY(-2px); }
.person-avatar {
  width: 60px; height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2a7fff, #00d4ff);
  margin: 0 auto 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px;
  overflow: hidden;
}
.person-avatar img { width: 100%; height: 100%; object-fit: cover; }
.person-name { font-weight: 600; font-size: 14px; }
.person-tag { font-size: 12px; color: #86868b; margin-top: 4px; }
.person-bl { border-color: #ff6b6b; }

/* ========== Search ========== */
.search-input {
  background: #1c1c1e;
  border: 1px solid #2a2a2c;
  color: #f5f5f7;
  padding: 8px 14px;
  border-radius: 6px;
  outline: none;
}
.search-input:focus { border-color: #2a7fff; }

/* ========== Blockchain ========== */
.blockchain-input {
  display: flex; gap: 10px; margin-bottom: 16px; align-items: center;
}
.blockchain-input input { flex: 1; }
.blockchain-result {
  background: #0a0a0c;
  border: 1px solid #2a2a2c;
  border-radius: 8px;
  padding: 16px;
  min-height: 120px;
  font-family: "Consolas", monospace;
  font-size: 13px;
  white-space: pre-wrap;
  word-break: break-all;
}
.empty-hint { color: #86868b; text-align: center; padding: 40px; font-family: inherit; }

/* ========== Settings ========== */
.settings-form { display: flex; flex-direction: column; gap: 14px; }
.form-row { display: flex; align-items: center; gap: 14px; }
.form-row label { width: 100px; color: #86868b; flex-shrink: 0; }
.form-row input { flex: 1; }
.test-result { padding: 10px 14px; border-radius: 6px; display: none; }
.test-result.ok { background: rgba(56,239,125,.15); color: #38ef7d; display: block; }
.test-result.err { background: rgba(255,107,107,.15); color: #ff6b6b; display: block; }

.help-text p { margin-bottom: 10px; line-height: 1.7; color: #c8c8cc; }
.help-text b { color: #2a7fff; }

/* ========== 响应式 ========== */
@media (max-width: 1024px) {
  .kpi-row { grid-template-columns: repeat(2, 1fr); }
  .grid-2 { grid-template-columns: 1fr; }
  .sidebar { width: 60px; }
  .logo-text, .nav-item span:not(.nav-ico), .sidebar-footer span:not(.status-dot) { display: none; }
}
@media (max-width: 600px) {
  .kpi-row { grid-template-columns: 1fr; }
}
