:root {
  --bg: #f6f7f5;
  --surface: #ffffff;
  --border: #dde1db;
  --text: #202422;
  --text-muted: #5c655e;
  --accent: #2f6f4f;
  --accent-ink: #1e4a34;
  --warn-bg: #fdf1e3;
  --warn-border: #e3b579;
  --warn-text: #7a4a12;
  --code-bg: #eef1ec;
}

* { box-sizing: border-box; }

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

header.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
}

header.topbar .brand {
  font-weight: 700;
  font-size: 1.1rem;
  padding: 14px 0;
  color: var(--accent-ink);
}

nav.mainnav {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

nav.mainnav a {
  display: inline-block;
  padding: 14px 10px;
  color: var(--text-muted);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  font-size: 0.92rem;
}

nav.mainnav a:hover { color: var(--text); }
nav.mainnav a.active { color: var(--accent-ink); border-bottom-color: var(--accent); font-weight: 600; }

main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 20px 60px;
}

h1 { font-size: 1.5rem; margin: 0 0 6px; }
h2 { font-size: 1.15rem; margin: 28px 0 10px; }
p.lede { color: var(--text-muted); margin-top: 0; }

.grid-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin: 16px 0 28px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px;
}

.card .num { font-size: 1.6rem; font-weight: 700; color: var(--accent-ink); }
.card .label { font-size: 0.82rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .03em; }

table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); font-size: 0.9rem; vertical-align: top; }
th { background: var(--code-bg); font-size: 0.75rem; text-transform: uppercase; letter-spacing: .03em; color: var(--text-muted); }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #fafbf9; }
a { color: var(--accent-ink); }

.filters { display: flex; flex-wrap: wrap; gap: 10px; margin: 12px 0 18px; align-items: end; }
.filters label { display: flex; flex-direction: column; font-size: 0.78rem; color: var(--text-muted); gap: 3px; }
.filters select, .filters input { padding: 6px 8px; border: 1px solid var(--border); border-radius: 5px; font-size: 0.88rem; background: var(--surface); color: var(--text); }
.filters button { padding: 7px 14px; border: 1px solid var(--accent); background: var(--accent); color: white; border-radius: 5px; cursor: pointer; font-size: 0.88rem; }

.searchbox { display: flex; gap: 8px; margin: 10px 0 24px; }
.searchbox input[type=search] { flex: 1; padding: 12px 14px; font-size: 1.05rem; border: 1px solid var(--border); border-radius: 8px; }
.searchbox button { padding: 0 20px; border: none; background: var(--accent); color: white; border-radius: 8px; cursor: pointer; font-size: 1rem; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 0.72rem; font-weight: 600; letter-spacing: .02em; }
.badge.type-explicit_fact { background: #dff0e3; color: #1e6b3a; }
.badge.type-user_statement { background: #e2ecfb; color: #1c4f8c; }
.badge.type-interpretation { background: #f3e6fb; color: #6a2c96; }
.badge.type-assumption { background: #fdf1e3; color: #8a5a12; }
.badge.type-ai_summary { background: #ececec; color: #4a4a4a; }
.badge.sensitive { background: var(--warn-bg); color: var(--warn-text); border: 1px solid var(--warn-border); }
.badge.status-active { background: #dff0e3; color: #1e6b3a; }
.badge.status-forgotten { background: #ececec; color: #666; }
.badge.status-deleted { background: #fbe2e2; color: #9c2b2b; }
.badge.entity-type { background: #e4e8f5; color: #2c3a72; }

.chip-list { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { background: var(--code-bg); border: 1px solid var(--border); border-radius: 999px; padding: 2px 10px; font-size: 0.78rem; }

.unknown-date { color: var(--text-muted); font-style: italic; }

.detail-box { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 18px 20px; margin-bottom: 20px; }
.detail-box .meta { display: flex; flex-wrap: wrap; gap: 8px 18px; color: var(--text-muted); font-size: 0.85rem; margin: 8px 0 14px; }
.detail-box blockquote.raw {
  border-left: 3px solid var(--border);
  margin: 10px 0 0;
  padding: 8px 14px;
  background: var(--code-bg);
  font-size: 0.88rem;
  color: var(--text-muted);
}
.raw-label { font-size: 0.72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); margin-bottom: 4px; display: block; }

.timeline-list { list-style: none; padding: 0; margin: 0; }
.timeline-list li { display: flex; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.timeline-list .date-col { width: 130px; flex-shrink: 0; font-size: 0.82rem; color: var(--text-muted); }
.timeline-list .date-col .known { color: var(--text); font-weight: 600; }

.status-bar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 20px; }
.status-ok { color: #1e6b3a; }
.status-fail { color: #9c2b2b; font-weight: 600; }

.empty-state { color: var(--text-muted); padding: 30px 0; text-align: center; }

footer.foot { max-width: 1100px; margin: 40px auto 0; padding: 16px 20px; color: var(--text-muted); font-size: 0.78rem; border-top: 1px solid var(--border); }
