:root {
  --bg: #f6f7f9;
  --card: #ffffff;
  --text: #1d232b;
  --muted: #5f6b7a;
  --line: #d9dee5;
  --accent: #1f6feb;
  --accent-text: #ffffff;
  --good: #1a7f37;
  --bad: #cf222e;
  --warn: #9a6700;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1318;
    --card: #171c23;
    --text: #e6edf3;
    --muted: #9aa7b4;
    --line: #2d3540;
    --accent: #4493f8;
    --accent-text: #0f1318;
    --good: #3fb950;
    --bad: #f85149;
    --warn: #d29922;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
}

.topbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--card);
}

.topbar h1 { font-size: 20px; margin: 0; }

.health { font-size: 14px; color: var(--muted); }
.health .ok { color: var(--good); }
.health .down { color: var(--bad); }

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

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px 20px;
  margin-bottom: 16px;
}

.card h2 { font-size: 18px; margin: 0 0 12px; display: flex; align-items: center; gap: 10px; }

.num {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-text);
  font-size: 15px;
}

.hidden { display: none !important; }
.muted { color: var(--muted); }

.drop {
  border: 2px dashed var(--line);
  border-radius: 10px;
  padding: 28px 16px;
  text-align: center;
}

.drop.over { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, transparent); }
.drop-big { font-size: 22px; margin: 0 0 4px; }

.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 14px; }
.row input { flex: 1 1 260px; }

input[type="text"], input[type="password"], select {
  min-height: 44px;
  padding: 8px 10px;
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  width: 100%;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  min-width: 44px;
  padding: 8px 18px;
  font: inherit;
  font-weight: 600;
  border-radius: 8px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: var(--accent-text);
  cursor: pointer;
}

.btn:disabled { opacity: 0.5; cursor: default; }
.btn-go { min-height: 56px; min-width: 160px; font-size: 20px; margin-top: 8px; }
.btn-quiet { background: transparent; color: var(--text); border-color: var(--line); }
.drop .btn { margin-top: 12px; }

.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin-bottom: 12px; }
.grid label { display: flex; flex-direction: column; gap: 4px; font-size: 14px; color: var(--muted); }
.grid .wide { grid-column: span 2; }
@media (max-width: 600px) { .grid .wide { grid-column: auto; } }

.sinks { border: 0; padding: 0; margin: 0 0 8px; }
.sinks legend { font-size: 14px; color: var(--muted); margin-bottom: 4px; }
.sinks label { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; margin-right: 20px; font-weight: 600; }
.sinks input { width: 22px; height: 22px; flex: none; }

/* Destination lists (Write to, Search in): one tick box per destination; engines that are not running are greyed out and cannot be ticked. */
.dest-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 4px 16px; margin-bottom: 8px; }
.dest-list label { margin-right: 0; }
.dest .dest-name { overflow-wrap: anywhere; }
.dest .dest-note { font-weight: 400; font-size: 14px; }
.dest.off { opacity: 0.55; cursor: not-allowed; }
.dest-help { margin: 6px 0 0; font-size: 14px; }

.check { display: flex; align-items: center; gap: 8px; min-height: 44px; font-weight: 600; }
.check input { width: 22px; height: 22px; }

.table-card { border: 1px solid var(--line); border-radius: 8px; padding: 12px; margin-bottom: 12px; }
.table-head { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: baseline; }
.table-head h3 { margin: 0; font-size: 17px; }
.table-head .key { margin-left: auto; display: flex; gap: 8px; align-items: center; font-size: 14px; }
.table-head .key select { width: auto; min-width: 200px; }

.preview { overflow-x: auto; margin-top: 10px; max-width: 100%; }
.preview table { border-collapse: collapse; font-size: 13px; }
.preview th, .preview td { border: 1px solid var(--line); padding: 4px 8px; text-align: left; white-space: nowrap; max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
.preview th { background: var(--bg); }

.bar { height: 14px; border-radius: 7px; background: var(--bg); border: 1px solid var(--line); overflow: hidden; }
#bar-fill { height: 100%; width: 0; background: var(--accent); transition: width 0.4s; }

.counters { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.counters div { background: var(--bg); border-radius: 8px; padding: 8px 10px; }
.counters dt { font-size: 13px; color: var(--muted); }
.counters dd { margin: 0; font-size: 20px; font-weight: 600; }

.errors { color: var(--bad); }
.status-Completed { color: var(--good); }
.status-Partial { color: var(--warn); }
.status-Failed, .status-Cancelled { color: var(--bad); }

.results { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 12px; margin-top: 12px; }
.results h3 { margin: 0 0 6px; font-size: 16px; }
.hit { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; margin-bottom: 8px; font-size: 14px; }
.hit .score { float: right; color: var(--muted); font-variant-numeric: tabular-nums; }
.hit pre { margin: 4px 0 0; white-space: pre-wrap; font: inherit; }

.runs-list { list-style: none; padding: 0; margin: 0; }
.runs-list li { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; min-height: 44px; margin-bottom: 6px; }
.runs-list .run-name { flex: 1 1 200px; }
#active-runs-box h3 { font-size: 16px; margin: 16px 0 6px; }
#pipelines-box h3 { font-size: 16px; margin: 16px 0 6px; }
.btn-danger { background: transparent; color: var(--bad); border-color: var(--bad); }
.btn-danger.armed { background: var(--bad); color: var(--accent-text); }
#reset-status { overflow-wrap: anywhere; }

/* Step 1 switch between a folder, a database and a git repository. Every button is big and always visible. */
.mode-switch { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.seg { flex: 1 1 180px; min-height: 52px; font-size: 18px; background: transparent; color: var(--text); border-color: var(--line); }
.seg.active { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }

/* Database (ODBC) source: login fields, the table picker and its rows. */
#source-odbc .grid { margin-top: 4px; }
#odbc-connect { margin-top: 4px; }
#odbc-status, #odbc-login-note, #odbc-picked { overflow-wrap: anywhere; }
.pick-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; margin: 14px 0 4px; }
.pick-filter { display: flex; flex-direction: column; gap: 4px; flex: 1 1 240px; font-size: 14px; color: var(--muted); }
.pick-list { max-height: 360px; overflow-y: auto; border: 1px solid var(--line); border-radius: 8px; }
.pick { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; min-height: 48px; padding: 6px 12px; border-bottom: 1px solid var(--line); cursor: pointer; }
.pick:last-child { border-bottom: 0; }
.pick:hover { background: var(--bg); }
.pick input { width: 22px; height: 22px; flex: none; }
.pick-name { flex: 1 1 220px; font-weight: 600; overflow-wrap: anywhere; }
.pill { font-size: 12px; font-weight: 600; letter-spacing: 0.04em; padding: 2px 8px; border-radius: 10px; border: 1px solid var(--line); color: var(--muted); }
.pick-empty { padding: 14px 12px; }
.table-note { margin: 6px 0 0; font-size: 14px; overflow-wrap: anywhere; }

/* Git repo source: the address boxes, the fetch status and the review card. */
#source-git .grid { margin-top: 4px; }
#git-status, #git-url-note { overflow-wrap: anywhere; }
.git-card h3 { overflow-wrap: anywhere; }
.git-card details { margin-top: 8px; }
.git-card ul { margin: 6px 0 0; padding-left: 20px; font-size: 14px; overflow-wrap: anywhere; }

/* Benchmark results pages (/bench-results): wide tables wrap instead of cutting text off. */
.bench { max-width: 1400px; margin: 16px auto; }
.bench .preview th, .bench .preview td { white-space: normal; max-width: 420px; overflow: visible; vertical-align: top; }
.bench pre { white-space: pre-wrap; word-break: break-all; background: var(--bg); padding: 8px; border-radius: 6px; font-size: 13px; }
.bench h1 { font-size: 22px; } .bench h2 { font-size: 18px; margin-top: 24px; } .bench h3 { font-size: 16px; margin-top: 18px; }
.topbar h1 a, .topbar > a { color: inherit; text-decoration: none; }

/* Benchmark summary block (/bench-results and the top of each run page): headline, bar chart, compact table, known problems, run list. */
.bench-summary { margin-bottom: 8px; }
.bench .bench-lead { font-size: 21px; line-height: 1.35; font-weight: 600; margin: 4px 0 8px; }
.bench-sub { margin: 0 0 6px; }
.bench-data { margin: 0 0 14px; font-size: 14px; }
.bench-flag { display: inline-block; margin-right: 6px; padding: 0 8px; border: 1px solid var(--warn); border-radius: 10px; color: var(--warn); font-size: 12px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; vertical-align: 1px; }
.bench-figure { margin: 0 0 14px; max-width: 760px; }
.bench-figure figcaption { margin-top: 4px; font-size: 13px; color: var(--muted); }
.bench-chart { display: block; overflow: visible; }
.bc-name { fill: var(--text); font-size: 13px; }
.bc-note { fill: var(--muted); font-size: 12px; font-style: italic; }
.bc-value { fill: var(--text); font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.bc-bar { fill: var(--accent); }
.bc-bar.bc-mem { fill: url(#bc-hatch); }
.bc-hatch-bg { fill: var(--accent); fill-opacity: 0.3; }
.bc-hatch-line { stroke: var(--accent); stroke-width: 2.5; }
.bc-range { stroke: var(--text); stroke-width: 1.5; stroke-linecap: round; }
.bc-row:hover .bc-bar { fill-opacity: 0.8; }
.bench .preview table.bench-table { font-size: 14px; }
.bench .preview .bench-table th, .bench .preview .bench-table td { padding: 5px 10px; }
.bench .bench-table .n { text-align: right; font-variant-numeric: tabular-nums; }
.bench .bench-table .bench-no { color: var(--warn); font-weight: 600; }
.bench-runs a { display: inline-block; min-height: 28px; font-weight: 600; }
.bench-caveats { margin: 20px 0 8px; padding: 10px 14px; border: 1px solid var(--warn); border-left-width: 4px; border-radius: 8px; background: color-mix(in srgb, var(--warn) 7%, transparent); }
.bench .bench-caveats h2 { margin: 0 0 6px; font-size: 16px; }
.bench-caveats ul { margin: 0; padding-left: 20px; }
.bench-caveats li { margin: 3px 0; }
.bench-caveats ol { margin: 0; padding-left: 24px; }
.bench-caveats ol > li { margin: 8px 0; }
.bench .bench-table tr.bench-unranked th { text-align: left; font-weight: 600; color: var(--muted); border-top: 2px solid var(--line); }
.bench .bench-table td[data-state="not-held"] { color: var(--warn); }
.bench details.bench-target { margin: 6px 0; padding: 0 12px; border: 1px solid var(--line); border-radius: 8px; }
.bench details.bench-target > summary { padding: 10px 0; min-height: 44px; font-weight: 600; cursor: pointer; }
.bench details.bench-target[open] { padding-bottom: 6px; }
.bench details.bench-target ul { margin-top: 0; }
.bench a { color: var(--accent); }
@media (max-width: 480px) {
  .bench.card { padding: 12px; }
  .bench .preview table.bench-table { font-size: 13px; }
  .bench .preview .bench-table th, .bench .preview .bench-table td { padding: 4px 5px; }
}
.bench details.bench-target > summary .muted { font-weight: 400; }

/* Long paths in the run notes wrap instead of pushing the page sideways at phone width. */
.bench li, .bench p { overflow-wrap: anywhere; }

/* Benchmark header (the Vector search benchmark page, /benchmark): what the numbers are of, then the engines in order of searches per second with eight at once. */
.bench-header { margin: 0 0 24px; padding: 14px 16px; border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: 8px; }
.bench .bench-header-lead { font-size: 21px; line-height: 1.35; font-weight: 600; margin: 0 0 6px; }
.bench-header-from, .bench-header-nodata { margin: 0 0 6px; font-size: 14px; }
.bench .bench-header h2.bench-header-sub { display: block; margin: 18px 0 4px; font-size: 18px; }
.bench-header-note, .bench-header-legend { margin: 0 0 8px; font-size: 14px; }
.bench .preview table.bench-header-table { font-size: 15px; }
.bench .preview .bench-header-table th, .bench .preview .bench-header-table td { padding: 6px 10px; }
.bench .bench-header-table .n { text-align: right; font-variant-numeric: tabular-nums; }
.bench-header-name { font-weight: 600; }
.bench-header-mark { margin-left: 4px; color: var(--muted); font-size: 12px; }
.bench .preview .bench-header-table tr.bench-header-note-row td { max-width: none; padding: 0 10px 8px; border-top: 0; }
.bench-header-note-block { padding: 6px 10px; border-left: 4px solid var(--text); background: color-mix(in srgb, var(--warn) 10%, transparent); }
.bench-header-memory { display: block; font-size: 19px; line-height: 1.25; font-weight: 800; color: var(--text); }
.bench-header-memory::first-letter { text-transform: uppercase; }
.bench-header-evidence, .bench-header-keep { display: block; margin-top: 3px; }
.bench .bench-header-table tr.bench-header-unranked th { text-align: left; font-weight: 600; color: var(--muted); border-top: 2px solid var(--line); }
.bench .bench-header-table td[data-state="not-held"], .bench .bench-header-table td[data-state="one-session"] { color: var(--warn); font-weight: 600; }
.bench-header-link { margin: 10px 0 4px; font-weight: 600; }
.bench-header-build { margin: 0; }
@media (max-width: 480px) {
  .bench-header { padding: 10px; }
  .bench .bench-header-lead { font-size: 18px; }
  .bench .preview table.bench-header-table { font-size: 13px; }
  .bench .preview .bench-header-table th, .bench .preview .bench-header-table td { padding: 4px 5px; }
  .bench-header-memory { font-size: 17px; }
}
