/* QEC dashboard — hand-rolled, no framework. */

:root {
  --bg: #fafaf8;
  --surface: #ffffff;
  --border: #e5e3dd;
  --text: #1b1b18;
  --muted: #5c5b56;
  --accent: #2a5fa5;
  --accent-soft: #e6edf6;

  --engineering: #2a7a3f;
  --moonshot:    #8a4ba0;
  --defer:       #b07418;
  --skip:        #8a8a82;
  --done:        #2a7a3f;
  --in_flight:   #b07418;
  --not_started: #8a8a82;

  --mono: ui-monospace, "SF Mono", "Menlo", "Consolas", monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Inter", system-ui, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
}

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

code, pre {
  font-family: var(--mono);
  font-size: 0.92em;
}
pre {
  background: #f0efea;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 12px 14px;
  overflow-x: auto;
}
:not(pre) > code {
  background: #f0efea;
  padding: 1px 5px;
  border-radius: 3px;
}

/* ---- Header / nav ---- */
.site-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border);
  padding: 14px 28px;
  background: var(--surface);
}
.brand a {
  font-weight: 600;
  font-size: 16px;
  color: var(--text);
}
.brand-sub {
  display: block;
  font-size: 12px;
  color: var(--muted);
}
.site-nav a {
  margin-left: 22px;
  color: var(--muted);
  font-weight: 500;
}
.site-nav a.active { color: var(--text); border-bottom: 2px solid var(--accent); padding-bottom: 2px; }
.site-nav a.external::after { content: " ↗"; font-size: 0.85em; }

main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px 28px 80px;
}

.site-footer {
  border-top: 1px solid var(--border);
  padding: 18px 28px;
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 12px;
  background: var(--surface);
}

/* ---- Headlines / counts ---- */
.page-title {
  font-size: 22px;
  font-weight: 600;
  margin: 0 0 18px;
}
.subtitle {
  color: var(--muted);
  margin: -10px 0 16px;
}

.formula {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 8px;
  font-family: var(--mono);
  font-size: 13px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 4px;
  padding: 10px 14px;
  margin: 4px 0 16px;
}
.formula-label { color: var(--muted); font-weight: 600; margin-right: 4px; }
.formula-term { color: var(--text); white-space: nowrap; }
.formula-term b { color: var(--accent); font-weight: 600; }
.formula-op { color: var(--muted); }

.meta-line { color: var(--muted); font-size: 12px; margin: 0 0 24px; }

/* ---- Intro panel ---- */
.intro {
  background: var(--accent-soft);
  border: 1px solid #c8d6e8;
  border-radius: 6px;
  padding: 14px 20px;
  margin: 0 0 32px;
  font-size: 13.5px;
  line-height: 1.6;
}
.intro > summary {
  cursor: pointer;
  font-size: 14px;
  list-style: none;
  user-select: none;
  color: var(--text);
  padding: 2px 0;
}
.intro > summary::-webkit-details-marker { display: none; }
.intro > summary::before {
  content: "▸ ";
  color: var(--accent);
  font-size: 11px;
  vertical-align: 1px;
  margin-right: 4px;
}
.intro[open] > summary::before { content: "▾ "; }
.intro > summary:hover { color: var(--accent); }

.intro-body { margin-top: 10px; color: var(--text); }
.intro-body p { margin: 0 0 12px; }
.intro-body p:last-child { margin-bottom: 0; }
.intro-body em { color: var(--text); font-style: italic; }

.intro-nav {
  font-size: 13px;
  color: var(--muted);
  padding-top: 8px;
  border-top: 1px dashed #c8d6e8;
}
.intro-nav a { font-weight: 500; }

.intro .badge { font-size: 10px; padding: 1px 6px; }

.counts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 12px;
  margin: 0 0 32px;
}
.count {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 14px 16px;
}
.count-num { font-size: 22px; font-weight: 600; }
.count-label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; }
a.count-link {
  text-decoration: none;
  color: var(--text);
  display: block;
  transition: border-color 120ms, background 120ms;
}
a.count-link:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}
a.count-link:hover .count-label { color: var(--accent); }

/* ---- Done page ---- */
.done-section-title {
  font-size: 15px;
  margin: 8px 0 2px;
  color: var(--text);
}

.done-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
  margin-top: 14px;
}

.done-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: border-color 120ms, box-shadow 120ms;
}
.done-card:hover {
  border-color: var(--accent);
  box-shadow: 0 1px 2px rgba(42, 95, 165, 0.08);
}

.done-card-header {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}
.done-code-id {
  font-family: var(--mono);
  font-weight: 600;
  font-size: 13px;
  color: var(--accent);
  text-decoration: none;
}
.done-code-id:hover { text-decoration: underline; }
.done-params {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
}
.done-name {
  margin: 0;
  font-weight: 500;
  font-size: 14px;
  color: var(--text);
}
.done-summary {
  margin: 0;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.5;
}
.done-card-footer {
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px dashed var(--border);
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  font-size: 12px;
}
.done-source code {
  font-size: 11px;
  background: #f0efea;
  padding: 1px 5px;
  border-radius: 3px;
}
.done-source { color: var(--text); text-decoration: none; }
.done-source:hover code { background: var(--accent-soft); color: var(--accent); }
.done-attempt { font-weight: 500; }

/* ---- Panels ---- */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 20px 22px;
  margin-bottom: 28px;
}
.panel h2 {
  font-size: 15px;
  margin: 0 0 14px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}
.panel h2 .panel-sub {
  font-weight: 400;
  color: var(--muted);
  font-size: 12px;
}

/* ---- Tables ---- */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
th, td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
th {
  font-weight: 600;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: #f5f4ef;
  cursor: pointer;
  user-select: none;
}
th.sortable:hover { color: var(--text); }
th.sorted-asc::after { content: " ↑"; color: var(--accent); }
th.sorted-desc::after { content: " ↓"; color: var(--accent); }
tbody tr:hover { background: #f7f6f1; }
td.num { font-variant-numeric: tabular-nums; text-align: right; }
td.code-id { font-family: var(--mono); font-size: 12px; }
td.rationale {
  color: var(--muted);
  max-width: 540px;
  font-size: 12px;
  line-height: 1.45;
}
td.rationale.full { max-width: none; }

/* ---- Badges ---- */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: white;
}
.badge.engineering { background: var(--engineering); }
.badge.moonshot { background: var(--moonshot); }
.badge.defer { background: var(--defer); }
.badge.skip { background: var(--skip); }
.badge.done { background: var(--done); }
.badge.in_flight { background: var(--in_flight); }
.badge.not_started { background: var(--not_started); }
.badge.pr-ready { background: var(--done); }
.badge.formalization { background: var(--in_flight); }
.badge.skeleton-review { background: var(--accent); }
.badge.approach-b-negative-result { background: var(--moonshot); }
.badge.hypothesis-pending { background: var(--moonshot); }
.badge.out_of_scope { background: var(--skip); }

/* ---- Filter chips (queue page) ---- */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin: 0 0 16px;
}
.filter-bar input[type="search"] {
  flex: 1;
  min-width: 220px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 13px;
  background: var(--surface);
  font-family: inherit;
}
.chip {
  padding: 4px 11px;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 12px;
  cursor: pointer;
  background: var(--surface);
  user-select: none;
  color: var(--muted);
}
.chip.active { background: var(--accent); color: white; border-color: var(--accent); }

/* ---- Axis bars (compact display in tables) ---- */
.axes-row {
  display: inline-flex;
  gap: 2px;
  vertical-align: middle;
}
.axis-bar {
  width: 18px;
  height: 14px;
  background: #ebe9e3;
  border-radius: 2px;
  position: relative;
  overflow: hidden;
}
.axis-bar > span {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--accent);
}
.axis-bar > span.fill-1 { height: 10%; } .axis-bar > span.fill-2 { height: 20%; }
.axis-bar > span.fill-3 { height: 30%; } .axis-bar > span.fill-4 { height: 40%; }
.axis-bar > span.fill-5 { height: 50%; } .axis-bar > span.fill-6 { height: 60%; }
.axis-bar > span.fill-7 { height: 70%; } .axis-bar > span.fill-8 { height: 80%; }
.axis-bar > span.fill-9 { height: 90%; } .axis-bar > span.fill-10 { height: 100%; }

/* ---- Code detail page ---- */
.code-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 8px;
}
.code-header h1 {
  margin: 0;
  font-size: 22px;
}
.code-params {
  font-family: var(--mono);
  color: var(--muted);
  font-size: 16px;
}
.code-meta {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  margin: 8px 0 24px;
  color: var(--muted);
  font-size: 13px;
}
.code-meta dl { display: flex; gap: 6px; margin: 0; }
.code-meta dt { font-weight: 600; color: var(--text); }
.code-meta dd { margin: 0; }

.two-col {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 24px;
}
@media (max-width: 760px) {
  .two-col { grid-template-columns: 1fr; }
}

.axes-detail {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 6px 16px;
  align-items: center;
  font-size: 13px;
}
.axes-detail .axis-bar-wide {
  height: 8px;
  background: #ebe9e3;
  border-radius: 2px;
  position: relative;
  overflow: hidden;
  min-width: 120px;
}
.axes-detail .axis-bar-wide > span {
  position: absolute; left: 0; top: 0; bottom: 0;
  background: var(--accent);
}
.axes-detail .axis-weight { color: var(--muted); font-size: 11px; font-family: var(--mono); }

.tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin: 18px 0 18px;
}
.tab {
  padding: 8px 16px;
  cursor: pointer;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  user-select: none;
  font-size: 13px;
  font-weight: 500;
}
.tab.active { color: var(--text); border-bottom-color: var(--accent); }

.tab-panel { display: none; }
.tab-panel.active { display: block; }

.md-body { line-height: 1.65; }
.md-body h1, .md-body h2, .md-body h3 { margin-top: 1.6em; margin-bottom: 0.4em; }
.md-body h1 { font-size: 22px; border-bottom: 1px solid var(--border); padding-bottom: 6px; }
.md-body h2 { font-size: 17px; }
.md-body h3 { font-size: 14px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.md-body h1:first-child, .md-body h2:first-child { margin-top: 0; }
.md-body table { margin: 16px 0; }
.md-body table th { background: var(--accent-soft); color: var(--text); }
.md-body blockquote {
  border-left: 3px solid var(--border);
  margin: 12px 0;
  padding: 4px 16px;
  color: var(--muted);
}

/* ---- Inflight cards on overview ---- */
.inflight-list {
  display: grid;
  gap: 12px;
}
.inflight-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--surface);
}
.inflight-card .code-id { font-family: var(--mono); font-weight: 600; }
.inflight-card .meta { color: var(--muted); font-size: 12px; }

/* ---- Commits ---- */
.commits {
  list-style: none;
  padding: 0;
  margin: 0;
  font-size: 13px;
}
.commits li { padding: 4px 0; display: grid; grid-template-columns: 80px 70px 1fr; gap: 12px; }
.commits .date { color: var(--muted); }
.commits .sha { font-family: var(--mono); font-size: 11px; }

/* ---- Misc ---- */
.note { color: var(--muted); font-size: 13px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
hr.soft { border: 0; border-top: 1px solid var(--border); margin: 32px 0; }
