:root {
  --bg: #0f1419;
  --panel: #1a2230;
  --panel2: #232c3d;
  --border: #2c3850;
  --text: #e6edf3;
  --muted: #8b96a8;
  --accent: #4f9eff;
  --success: #3fb950;
  --warn: #f0a800;
  --danger: #f85149;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
}
header {
  position: sticky; top: 0; z-index: 10;
  background: var(--panel);
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: 12px;
}
header h1 { margin: 0; font-size: 18px; font-weight: 600; }
.controls { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.range-tabs { display: flex; gap: 4px; background: var(--panel2); padding: 4px; border-radius: 8px; }
.range-tabs button {
  background: transparent; color: var(--muted); border: 0;
  padding: 6px 14px; border-radius: 6px; cursor: pointer; font-size: 13px;
}
.range-tabs button.active { background: var(--accent); color: white; }
.btn {
  background: var(--accent); color: white; border: 0;
  padding: 7px 16px; border-radius: 6px; cursor: pointer; font-size: 13px;
}
.btn.secondary { background: var(--panel2); color: var(--text); border: 1px solid var(--border); }
.btn:hover { opacity: 0.9; }
.sync-info { color: var(--muted); font-size: 12px; }

main { padding: 20px 24px; }

.cards {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px; margin-bottom: 20px;
}
.card {
  background: var(--panel); border: 1px solid var(--border); border-radius: 10px;
  padding: 16px;
}
.card .label { color: var(--muted); font-size: 12px; margin-bottom: 8px; }
.card .value { font-size: 26px; font-weight: 600; color: var(--text); }
.card .sub { color: var(--muted); font-size: 12px; margin-top: 4px; }
.card .value.success { color: var(--success); }
.card .value.warn { color: var(--warn); }

.panel {
  background: var(--panel); border: 1px solid var(--border); border-radius: 10px;
  padding: 16px 20px; margin-bottom: 20px;
}
.panel h2 { margin: 0 0 14px; font-size: 16px; font-weight: 600; }
.panel h3 { margin: 0 0 8px; font-size: 13px; color: var(--muted); font-weight: 500; }

.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; margin-top: 8px; }
.grid-2x2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.grid-2x2 > div { background: var(--panel2); padding: 12px; border-radius: 8px; }
.grid-2 > div { background: var(--panel2); padding: 12px; border-radius: 8px; }

canvas { max-height: 280px; }

.matrix {
  background: var(--panel2); padding: 8px; border-radius: 8px; overflow-x: auto;
}
.matrix table { border-collapse: collapse; font-size: 12px; }
.matrix th, .matrix td {
  padding: 6px 10px; text-align: center; min-width: 60px; border: 1px solid var(--border);
}
.matrix th { background: var(--panel); color: var(--muted); font-weight: 500; }
.matrix td.row-label { background: var(--panel); color: var(--text); text-align: left; font-weight: 500; }
.matrix td.heat { color: white; font-weight: 500; }

.table { width: 100%; border-collapse: collapse; font-size: 13px; margin-top: 8px; }
.table th, .table td { padding: 8px 12px; text-align: left; border-bottom: 1px solid var(--border); }
.table th { background: var(--panel2); color: var(--muted); font-weight: 500; }
.table tr:hover { background: var(--panel2); }

.recent { display: flex; flex-direction: column; gap: 8px; }
.recent .item {
  background: var(--panel2); border-left: 3px solid var(--accent);
  padding: 10px 14px; border-radius: 6px;
  display: flex; justify-content: space-between; align-items: center;
  font-size: 13px;
}
.recent .empty { color: var(--muted); padding: 8px; }
.recent .time { color: var(--muted); font-size: 12px; }

.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.filters select {
  background: var(--panel2); color: var(--text); border: 1px solid var(--border);
  padding: 6px 10px; border-radius: 6px; font-size: 13px;
}

.pager { margin-top: 12px; display: flex; gap: 12px; align-items: center; }
.pager #pageInfo { color: var(--muted); }

.tag {
  display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 11px; margin-right: 4px;
}
.tag.green { background: rgba(63,185,80,0.2); color: var(--success); }
.tag.yellow { background: rgba(240,168,0,0.2); color: var(--warn); }
.tag.red { background: rgba(248,81,73,0.2); color: var(--danger); }
.tag.blue { background: rgba(79,158,255,0.2); color: var(--accent); }
.tag.gray { background: var(--panel); color: var(--muted); }

@media (max-width: 900px) {
  .grid-2, .grid-2x2 { grid-template-columns: 1fr; }
  header { flex-direction: column; align-items: flex-start; }
}
