:root {
  --bg: #0f1419;
  --panel: #161b22;
  --panel-2: #1d242d;
  --border: #2a323d;
  --text: #e6edf3;
  --muted: #8b949e;
  --accent: #58a6ff;
  --pass: #3fb950;
  --warn: #d29922;
  --fail: #f85149;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

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

header, main, footer {
  max-width: 1280px;
  margin: 0 auto;
  padding: 1.25rem 1.75rem;
}

header { padding-bottom: 0.5rem; }
header h1 { margin: 0 0 0.2rem; font-size: 1.5rem; letter-spacing: -0.01em; }
.subtitle { margin: 0; color: var(--muted); font-size: 0.95rem; }
.muted { color: var(--muted); font-size: 0.85rem; }

/* Toolbar ------------------------------------------------------------------ */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 1rem;
  padding: 0.75rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.toolbar input[type="search"] {
  flex: 1 1 220px;
  min-width: 180px;
  padding: 0.45rem 0.6rem;
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 5px;
  font-size: 0.9rem;
}

.toolbar select,
.toolbar input[type="date"],
.toolbar button {
  padding: 0.45rem 0.55rem;
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 5px;
  font-size: 0.85rem;
}

.toolbar button { cursor: pointer; }
.toolbar button:hover { background: #232c38; }
.toolbar .date-range { display: inline-flex; gap: 0.3rem; align-items: center; }
.toolbar .date-range input[type="date"] { padding: 0.35rem 0.45rem; }

#result-count { margin-left: auto; }

/* Table -------------------------------------------------------------------- */
.reports-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  font-size: 0.86rem;
}

.reports-table thead tr {
  background: var(--panel-2);
}

.reports-table th,
.reports-table td {
  padding: 0.55rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.reports-table tbody tr:hover { background: rgba(88, 166, 255, 0.05); }
.reports-table tbody tr:last-child td { border-bottom: none; }

.reports-table th.sortable { cursor: pointer; user-select: none; }
.reports-table th.sortable:hover { color: var(--accent); }
.reports-table th.sort-asc::after  { content: " ▲"; color: var(--accent); font-size: 0.7em; }
.reports-table th.sort-desc::after { content: " ▼"; color: var(--accent); font-size: 0.7em; }

.reports-table td.col-date { white-space: nowrap; font-family: var(--mono); color: var(--muted); }
.reports-table td.col-title { font-weight: 500; }
.reports-table td.col-type  { font-family: var(--mono); font-size: 0.8rem; }
.reports-table td.col-open a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}
.reports-table td.col-open a:hover { text-decoration: underline; }

.pill {
  display: inline-block;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  font-size: 0.75rem;
  font-family: var(--mono);
  color: var(--muted);
}

.pill.tier { color: var(--accent); border-color: rgba(88, 166, 255, 0.4); }
.pill.strategy { color: var(--pass); border-color: rgba(63, 185, 80, 0.35); }
.pill.kind { color: var(--warn); border-color: rgba(210, 153, 34, 0.35); }
.pill.type-pdf { color: var(--fail); border-color: rgba(248, 81, 73, 0.35); }
.pill.type-md  { color: var(--accent); border-color: rgba(88, 166, 255, 0.35); }

.empty { text-align: center; padding: 2rem; color: var(--muted); }
.hidden { display: none; }

/* Markdown render page ----------------------------------------------------- */
.md-page { }
.md-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.75rem;
  max-width: 960px;
  margin: 0 auto;
  border-bottom: 1px solid var(--border);
}
.md-header .back { color: var(--accent); text-decoration: none; }
.md-header .back:hover { text-decoration: underline; }
.md-header .meta { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.meta-pill {
  display: inline-block;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  font-size: 0.72rem;
  font-family: var(--mono);
  color: var(--muted);
}
.meta-tier     { color: var(--accent); border-color: rgba(88, 166, 255, 0.35); }
.meta-strategy { color: var(--pass);   border-color: rgba(63, 185, 80, 0.3); }
.meta-agent    { color: var(--warn);   border-color: rgba(210, 153, 34, 0.3); }
.meta-kind     { color: var(--muted); }

.md-body {
  max-width: 960px;
  margin: 0 auto;
  padding: 1.5rem 1.75rem;
}
.md-body h1, .md-body h2, .md-body h3 { letter-spacing: -0.01em; }
.md-body h1 { font-size: 1.5rem; }
.md-body h2 { font-size: 1.2rem; margin-top: 1.5rem; }
.md-body h3 { font-size: 1rem; margin-top: 1.2rem; }
.md-body p, .md-body li { line-height: 1.6; }
.md-body code {
  font-family: var(--mono);
  font-size: 0.85em;
  background: rgba(255,255,255,0.06);
  padding: 0.05rem 0.35rem;
  border-radius: 3px;
}
.md-body pre {
  background: var(--panel);
  border: 1px solid var(--border);
  padding: 0.75rem 1rem;
  border-radius: 6px;
  overflow-x: auto;
}
.md-body pre code { background: none; padding: 0; }
.md-body table {
  border-collapse: collapse;
  margin: 0.75rem 0;
  width: 100%;
  font-size: 0.85rem;
}
.md-body th, .md-body td {
  border: 1px solid var(--border);
  padding: 0.35rem 0.6rem;
  text-align: left;
}
.md-body th { background: var(--panel-2); }
.md-body blockquote {
  border-left: 3px solid var(--accent);
  padding: 0.2rem 0.9rem;
  margin: 0.75rem 0;
  background: rgba(88, 166, 255, 0.05);
  color: #c9d1d9;
}
.md-body a { color: var(--accent); }
.md-body hr { border: none; border-top: 1px solid var(--border); margin: 1.5rem 0; }

.md-footer {
  max-width: 960px;
  margin: 0 auto;
  padding: 1rem 1.75rem 2rem;
  border-top: 1px solid var(--border);
}
