:root {
  --bg: #0f1115;
  --surface: #181b22;
  --surface-2: #21252e;
  --border: #2c313c;
  --text: #e8eaf0;
  --muted: #8b91a1;
  --accent: #4f8cff;
  --danger: #e85a4f;
  --warning: #f5b342;
  --ok: #4caf50;
}

* { box-sizing: border-box; }

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

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

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.brand { font-weight: 600; font-size: 1.1rem; color: var(--text); }
.topbar nav { display: flex; gap: 18px; align-items: center; }
.topbar nav a { color: var(--text); }
.link-button {
  background: none; border: none; color: var(--muted);
  font: inherit; cursor: pointer; padding: 0;
}

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

h1 { margin-top: 0; }
h2 { margin-top: 32px; border-bottom: 1px solid var(--border); padding-bottom: 6px; }

.muted { color: var(--muted); }
.error { color: var(--danger); }
.center { text-align: center; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px 24px;
  margin: 16px 0;
}
.card.narrow { max-width: 420px; margin: 32px auto; }
.card.warning { border-color: var(--warning); }

.hero { max-width: 560px; margin: 32px auto; }
.lede { font-size: 1.1rem; color: var(--muted); }

form { display: flex; flex-direction: column; gap: 6px; }
form.inline { display: inline-flex; flex-direction: row; gap: 8px; align-items: center; }
label { font-size: 0.85rem; color: var(--muted); margin-top: 8px; }
input, select, textarea {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
  font: inherit;
}
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent); }

button {
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 6px;
  padding: 9px 16px;
  font: inherit;
  cursor: pointer;
  margin-top: 12px;
}
button.primary { background: var(--accent); }
button.danger { background: var(--danger); }
button:hover { filter: brightness(1.05); }

.search-bar { flex-direction: row; align-items: center; gap: 8px; margin-bottom: 20px; }
.search-bar input { flex: 1; }

table.data {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0;
}
table.data th, table.data td {
  text-align: left;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
}
table.data th { color: var(--muted); font-weight: 500; font-size: 0.85rem; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.row-actions form { display: inline-block; margin-right: 6px; }

.pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}
.pill-FACT { background: rgba(76,175,80,0.15); color: var(--ok); }
.pill-INFERENCE { background: rgba(79,140,255,0.15); color: var(--accent); }
.pill-HYPOTHESIS { background: rgba(245,179,66,0.15); color: var(--warning); }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
dl { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; }
dt { color: var(--muted); }

.graph-page { display: flex; flex-direction: column; height: calc(100vh - 140px); }
.graph-controls { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
#cy {
  flex: 1;
  min-height: 500px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-top: 12px;
}
#node-panel {
  position: fixed; right: 24px; bottom: 24px;
  max-width: 280px;
}
#node-panel.hidden { display: none; }
.button {
  display: inline-block;
  background: var(--accent);
  color: white;
  padding: 6px 12px;
  border-radius: 6px;
  margin-top: 8px;
}

.rationale { max-width: 360px; color: var(--muted); font-size: 0.9rem; }
