:root {
  --bg: #0f1117;
  --surface: #181b23;
  --surface-2: #20242f;
  --border: #2a2f3a;
  --text: #e6e8ee;
  --muted: #9aa3b2;
  --accent: #5b8cff;
  --accent-soft: rgba(91, 140, 255, 0.15);
  --mark: #ffd86b;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

header.topbar {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 14px 28px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar .brand { font-weight: 700; font-size: 18px; color: var(--text); }
.topbar nav { display: flex; gap: 18px; }
.topbar nav a { color: var(--muted); font-size: 14px; }
.topbar nav a.active, .topbar nav a:hover { color: var(--text); }

main { max-width: 1040px; margin: 0 auto; padding: 28px; }

h1 { font-size: 22px; margin: 0 0 18px; }
h2 { font-size: 17px; margin: 28px 0 12px; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow);
}
.stat-card .value { font-size: 30px; font-weight: 700; }
.stat-card .label { color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: .04em; }

.type-bars { display: flex; flex-direction: column; gap: 8px; }
.type-bar { display: grid; grid-template-columns: 120px 1fr 48px; align-items: center; gap: 10px; font-size: 14px; }
.type-bar .track { background: var(--surface-2); border-radius: 6px; height: 10px; overflow: hidden; }
.type-bar .fill { background: var(--accent); height: 100%; }
.type-bar .count { text-align: right; color: var(--muted); }

.controls { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 20px; }
input, select {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 14px;
}
input:focus, select:focus { outline: none; border-color: var(--accent); }
input[type="search"] { flex: 1; min-width: 220px; }
button {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 9px 16px;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
}
button.secondary { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }

.report-list { display: flex; flex-direction: column; gap: 12px; }
.report-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow);
}
.report-card h3 { margin: 0 0 6px; font-size: 16px; }
.report-card .meta { color: var(--muted); font-size: 13px; display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.report-card .excerpt { margin-top: 8px; color: var(--text); font-size: 14px; }
.report-card mark { background: var(--mark); color: #1a1a1a; padding: 0 2px; border-radius: 2px; }

.badge {
  display: inline-block;
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 12px;
  font-weight: 600;
}
.tag {
  display: inline-block;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 6px;
  padding: 1px 8px;
  font-size: 12px;
}
.tags { display: flex; flex-wrap: wrap; gap: 6px; }

.pagination { display: flex; gap: 10px; align-items: center; justify-content: center; margin-top: 24px; }
.empty { color: var(--muted); text-align: center; padding: 48px; }

/* Report view */
.report-meta { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; color: var(--muted); font-size: 14px; margin-bottom: 20px; }
.markdown-body {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 28px;
}
.markdown-body h1, .markdown-body h2, .markdown-body h3 { border-bottom: 1px solid var(--border); padding-bottom: 6px; }
.markdown-body pre {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px;
  overflow-x: auto;
}
.markdown-body code { background: var(--surface-2); padding: 2px 5px; border-radius: 4px; font-size: 13px; }
.markdown-body pre code { background: none; padding: 0; }
.markdown-body blockquote { border-left: 3px solid var(--accent); margin: 0; padding: 4px 16px; color: var(--muted); }
.markdown-body table { border-collapse: collapse; width: 100%; }
.markdown-body th, .markdown-body td { border: 1px solid var(--border); padding: 6px 10px; text-align: left; }

/* Timeline */
.timeline { position: relative; margin-left: 8px; padding-left: 24px; border-left: 2px solid var(--border); }
.timeline-item { position: relative; padding: 10px 0 18px; }
.timeline-item::before {
  content: ""; position: absolute; left: -31px; top: 16px;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--accent); border: 2px solid var(--bg);
}
.timeline-date { color: var(--muted); font-size: 12px; }
