:root {
  --bg: #0f1115;
  --panel: #181b22;
  --line: #2a2f3a;
  --fg: #e6e8ec;
  --muted: #97a0ad;
  --accent: #4c8bf5;
  --accent2: #2c6ad4;
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--fg);
  font: 15px/1.45 system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}
header, main, footer { max-width: 1100px; margin: 0 auto; padding: 0 16px; }
header { padding-top: 24px; }
h1 { margin: 0 0 4px; font-size: 26px; }
.sub { color: var(--muted); margin: 0 0 16px; }
h2 { margin: 0 0 12px; font-size: 18px; }

.panel {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 10px; padding: 16px; margin-bottom: 16px;
}
.row { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-end; margin-bottom: 10px; }
label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.range { display: flex; align-items: center; gap: 6px; color: var(--fg); }

select, input, button {
  background: #11141a; color: var(--fg); border: 1px solid var(--line);
  border-radius: 7px; padding: 7px 9px; font: inherit;
}
select[multiple] { min-width: 120px; height: 34px; }
select[multiple]:focus { height: auto; }
input[type=text] { min-width: 220px; }
input[type=number] { width: 90px; }

button { cursor: pointer; }
button:hover:not(:disabled) { border-color: var(--accent); }
button:disabled { opacity: .45; cursor: default; }
button.primary { background: var(--accent2); border-color: var(--accent2); color: #fff; font-weight: 600; }
button.primary:hover { background: var(--accent); }

.status { margin: 6px 0 0; color: var(--muted); font-size: 13px; min-height: 18px; }
.status.busy::after { content: " ⏳"; }

.cards { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 12px; }
.card {
  background: #11141a; border: 1px solid var(--line); border-radius: 8px;
  padding: 8px 12px; min-width: 92px;
}
.card .num { font-size: 18px; font-weight: 700; }
.card .lbl { font-size: 11px; color: var(--muted); }

.resultsHead { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.actions { display: flex; gap: 8px; align-items: center; }
.muted { color: var(--muted); font-weight: 400; }

label.inline { flex-direction: row; align-items: center; gap: 6px; color: var(--fg); font-size: 13px; }
.colpick { position: relative; }
.colpick > summary {
  list-style: none; cursor: pointer; user-select: none;
  background: #11141a; border: 1px solid var(--line); border-radius: 7px; padding: 7px 9px;
}
.colpick > summary::-webkit-details-marker { display: none; }
.colpick > summary:hover { border-color: var(--accent); }
.colChecks {
  position: absolute; right: 0; z-index: 10; margin-top: 6px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px;
  padding: 8px; width: 270px; max-height: 340px; overflow: auto;
  box-shadow: 0 8px 24px rgba(0,0,0,.45);
}
.colItem { display: flex; flex-direction: row; align-items: center; gap: 6px;
  color: var(--fg); font-size: 13px; padding: 2px 4px; }
.colItem:hover { background: #1b1f27; border-radius: 4px; }

.chartBlock { margin-top: 18px; }
.chartBlock:first-of-type { margin-top: 6px; }
.chartBlock h3 { margin: 0 0 6px; font-size: 15px; }
.chartBlock .detailWrap { margin-top: 12px; }
.empty { margin: 6px 0 0; }
.chartWrap { overflow-x: auto; margin-top: 8px; }
.chartWrap svg { display: block; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 10px; color: var(--muted); font-size: 12px; }
.legend .lg { display: inline-flex; align-items: center; gap: 6px; }
.legend .lg i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }

.detailWrap { overflow-x: auto; margin-top: 18px; }
.detailWrap h3 { margin: 0 0 8px; font-size: 14px; color: var(--muted); font-weight: 600; }
table.detail { border-collapse: collapse; font-size: 13px; }
table.detail th, table.detail td {
  padding: 5px 12px; border-bottom: 1px solid var(--line);
  text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums;
}
table.detail thead th { position: sticky; top: 0; background: #1d212a; color: var(--fg); }
table.detail th:first-child, table.detail td:first-child { text-align: left; }
table.detail tbody tr:hover { background: #1b1f27; }
table.detail tfoot th { border-top: 2px solid var(--line); color: var(--fg); }

p.hint { margin: 0 0 10px; font-size: 12px; }
table.matches tbody tr { cursor: pointer; }
table.matches tbody tr:hover { background: #243049; }
table.matches td.nm { text-align: left; max-width: 340px; overflow: hidden; text-overflow: ellipsis; }

.tableWrap { overflow-x: auto; margin-top: 8px; }
table { border-collapse: collapse; width: 100%; font-size: 13px; }
th, td { text-align: left; padding: 6px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { position: sticky; top: 0; background: #1d212a; cursor: pointer; user-select: none; }
td { font-variant-numeric: tabular-nums; }
tbody tr:hover { background: #1b1f27; }
table.mini { width: auto; margin-top: 4px; }
table.mini th, table.mini td { padding: 3px 14px 3px 0; border: 0; }

.pager { display: flex; gap: 12px; align-items: center; margin-top: 10px; }
footer { color: var(--muted); font-size: 12px; padding: 16px 16px 40px; }
code { background: #11141a; padding: 1px 5px; border-radius: 4px; }
