:root {
  --bg: #f4f5f7;
  --card: #fff;
  --text: #1a1d21;
  --muted: #6b7280;
  --border: #e5e7eb;
  --accent: #2563eb;
  --accent-soft: #eff6ff;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}

.layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 200px;
  background: var(--card);
  border-right: 1px solid var(--border);
  padding: 20px 0;
  flex-shrink: 0;
}

.logo {
  padding: 0 20px 20px;
  font-weight: 600;
  font-size: 15px;
  color: var(--accent);
}

.nav a {
  display: block;
  padding: 10px 20px;
  color: var(--muted);
  text-decoration: none;
  border-left: 3px solid transparent;
}

.nav a:hover,
.nav a.active {
  color: var(--text);
  background: var(--accent-soft);
  border-left-color: var(--accent);
}

.main {
  flex: 1;
  padding: 24px 28px;
  overflow: auto;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}

.topbar h1 {
  font-size: 20px;
  font-weight: 600;
}

.range-select {
  display: flex;
  gap: 8px;
}

.range-select button,
.btn {
  border: 1px solid var(--border);
  background: var(--card);
  padding: 6px 14px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 13px;
  color: var(--text);
}

.range-select button.active,
.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.metric-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.metric-card .label {
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 6px;
}

.metric-card .value {
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}

.panel h2 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

@media (max-width: 900px) {
  .grid-2 {
    grid-template-columns: 1fr;
  }
  .layout {
    flex-direction: column;
  }
  .sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .nav {
    display: flex;
    overflow-x: auto;
  }
  .nav a {
    border-left: none;
    border-bottom: 3px solid transparent;
    white-space: nowrap;
  }
  .nav a.active {
    border-bottom-color: var(--accent);
  }
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  text-align: left;
  padding: 10px 8px;
  border-bottom: 1px solid var(--border);
}

th {
  color: var(--muted);
  font-weight: 500;
  font-size: 12px;
}

tr:last-child td {
  border-bottom: none;
}

.bar-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.bar-row .name {
  width: 120px;
  flex-shrink: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bar-row .track {
  flex: 1;
  height: 8px;
  background: var(--bg);
  border-radius: 4px;
  overflow: hidden;
}

.bar-row .fill {
  height: 100%;
  background: var(--accent);
  border-radius: 4px;
}

.bar-row .num {
  width: 48px;
  text-align: right;
  color: var(--muted);
  font-size: 12px;
}

.chart-wrap {
  height: 220px;
  position: relative;
}

.hidden {
  display: none !important;
}

.login-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.login-box {
  background: var(--card);
  padding: 28px;
  border-radius: var(--radius);
  width: 320px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.login-box input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin: 12px 0 16px;
}

.heatmap-wrap {
  position: relative;
  width: 100%;
  max-width: 900px;
  height: 400px;
  background: #fafafa;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.heatmap-dot {
  position: absolute;
  width: 24px;
  height: 24px;
  margin: -12px 0 0 -12px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(239, 68, 68, 0.7) 0%, rgba(239, 68, 68, 0) 70%);
  pointer-events: none;
}

.path-select {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  min-width: 200px;
  margin-bottom: 16px;
}

#replay-container {
  min-height: 360px;
  background: #111;
  border-radius: var(--radius);
}

.empty {
  color: var(--muted);
  padding: 24px;
  text-align: center;
}
