:root {
  color-scheme: light;
  --bg: #f4f3f0;
  --surface: #fcfcfb;
  --surface-2: #f0efec;
  --border: #e2e0da;
  --grid: #e9e7e2;
  --text: #0b0b0b;
  --text-2: #52514e;
  --muted: #7a7973;
  --accent: #2a78d6;
  --accent-ink: #1c5cab;
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100;
  --gold: #c98500; --silver: #8d8c85; --bronze: #b4643a;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.04), 0 4px 16px rgb(0 0 0 / 0.04);
  --radius: 12px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #121211; --surface: #1a1a19; --surface-2: #232321; --border: #2f2f2c; --grid: #2a2a28;
    --text: #ffffff; --text-2: #c3c2b7; --muted: #8f8e86;
    --accent: #3987e5; --accent-ink: #86b6ef;
    --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500;
    --shadow: none;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #121211; --surface: #1a1a19; --surface-2: #232321; --border: #2f2f2c; --grid: #2a2a28;
  --text: #ffffff; --text-2: #c3c2b7; --muted: #8f8e86;
  --accent: #3987e5; --accent-ink: #86b6ef;
  --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500;
  --shadow: none;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 var(--font); }
a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.2; margin: 0; }
h1 { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; }
h2 { font-size: 18px; font-weight: 650; }
h3 { font-size: 15px; font-weight: 650; }
.num, td.num, th.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }

/* Header with a chequered-flag strip */
.top { background: #0e0e0d; color: #fff; position: sticky; top: 0; z-index: 10; }
.top::after {
  content: ""; display: block; height: 6px;
  background: repeating-conic-gradient(#fff 0 25%, #0e0e0d 0 50%) 0 0 / 12px 12px;
}
.top-inner { max-width: 1120px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.brand { color: #fff; font-weight: 800; letter-spacing: 0.02em; font-size: 17px; display: flex; align-items: center; gap: 8px; }
.brand:hover { text-decoration: none; }
.brand small { font-weight: 500; color: #b9b8b0; letter-spacing: 0; }
.bolt { width: 22px; height: 22px; border-radius: 6px; background: var(--s1); display: grid; place-items: center; }
nav { display: flex; gap: 4px; flex-wrap: wrap; }
nav a { color: #d8d7d0; padding: 6px 10px; border-radius: 8px; font-size: 14px; }
nav a:hover { background: #252523; text-decoration: none; }
nav a.active { color: #fff; background: #2b2b29; }
.top-tools { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.search { position: relative; }
.search input {
  width: 220px; max-width: 46vw; background: #232321; border: 1px solid #3a3a37; color: #fff;
  border-radius: 8px; padding: 7px 10px; font: inherit; font-size: 14px;
}
.search input::placeholder { color: #8f8e86; }
.search-results {
  position: absolute; right: 0; top: calc(100% + 6px); width: 280px; max-height: 360px; overflow: auto;
  background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 8px 30px rgb(0 0 0 / 0.2); padding: 4px; z-index: 20;
}
.search-results a { display: block; padding: 8px 10px; border-radius: 6px; color: var(--text); }
.search-results a:hover, .search-results a.sel { background: var(--surface-2); text-decoration: none; }
.icon-btn { background: transparent; border: 1px solid #3a3a37; color: #d8d7d0; border-radius: 8px; padding: 6px 9px; cursor: pointer; font: inherit; line-height: 1; }

main { max-width: 1120px; margin: 0 auto; padding: 24px 16px 64px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.kicker { color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600; margin-bottom: 4px; }
.sub { color: var(--text-2); margin-top: 6px; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.card + .card, .stack > * + * { margin-top: 16px; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.card-head p { margin: 0; color: var(--muted); font-size: 13px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.tile .label { color: var(--text-2); font-size: 13px; }
.tile .value { font-size: 26px; font-weight: 650; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.tile .note { color: var(--muted); font-size: 12px; }

.hero {
  background: linear-gradient(135deg, #0e0e0d 0%, #1b2a3f 100%); color: #fff; border-radius: 16px;
  padding: 28px; margin-bottom: 16px; position: relative; overflow: hidden;
}
.hero::after {
  content: ""; position: absolute; right: -40px; top: -40px; width: 220px; height: 220px; opacity: 0.08; transform: rotate(12deg);
  background: repeating-conic-gradient(#fff 0 25%, transparent 0 50%) 0 0 / 40px 40px;
}
.hero h1 { font-size: 34px; }
.hero p { color: #c9c8c0; margin: 8px 0 0; max-width: 560px; }
.hero .search input { width: 340px; max-width: 100%; padding: 11px 14px; font-size: 16px; }
.hero .search { margin-top: 18px; max-width: 340px; }
.hero .search-results { left: 0; right: auto; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-weight: 600; color: var(--text-2); font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; padding: 8px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 9px 10px; border-bottom: 1px solid var(--grid); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: var(--surface-2); }
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: var(--text); }
th.sorted::after { content: " ▾"; }
th.sorted.asc::after { content: " ▴"; }
.table-wrap { overflow-x: auto; margin: 0 -18px; padding: 0 18px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

.pos { display: inline-grid; place-items: center; min-width: 26px; height: 26px; border-radius: 7px; background: var(--surface-2); font-weight: 650; font-variant-numeric: tabular-nums; font-size: 13px; }
.pos.p1 { background: var(--gold); color: #000; }
.pos.p2 { background: var(--silver); color: #000; }
.pos.p3 { background: var(--bronze); color: #fff; }
.chip { display: inline-block; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); color: var(--text-2); font-size: 12px; white-space: nowrap; }
.chip.main { background: color-mix(in srgb, var(--s1) 16%, transparent); color: var(--accent-ink); }
.flag { color: var(--muted); font-size: 12px; cursor: help; }

.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.tabs button {
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2); border-radius: 999px;
  padding: 5px 12px; font: inherit; font-size: 13px; cursor: pointer;
}
.tabs button.on { background: var(--text); color: var(--bg); border-color: var(--text); }

.btn { background: var(--accent); color: #fff; border: 0; border-radius: 8px; padding: 8px 14px; font: inherit; font-weight: 600; cursor: pointer; }
.btn:disabled { opacity: 0.6; cursor: default; }
.btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--border); }

.list a.row { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--grid); color: var(--text); }
.list a.row:last-child { border-bottom: 0; }
.list a.row:hover { text-decoration: none; color: var(--accent-ink); }

.winner { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--grid); }
.winner:last-child { border-bottom: 0; }
.winner .cls { color: var(--text-2); font-size: 13px; }

/* Charts */
.chart { position: relative; width: 100%; touch-action: pan-y; }
.chart svg { display: block; overflow: visible; }
.chart .grid { stroke: var(--grid); stroke-width: 1; }
.chart .baseline { stroke: var(--border); stroke-width: 1; }
.chart .tick { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart .axis-title { fill: var(--muted); font-size: 11px; }
.chart .line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .dot { stroke: var(--surface); stroke-width: 2; }
.chart .dot.on { r: 6; }
.chart .crosshair { stroke: var(--muted); stroke-width: 1; }
.chart .bar { transition: opacity 0.1s; }
.chart .bar.dim { opacity: 0.35; }
.chart-tip {
  position: absolute; pointer-events: none; background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; padding: 8px 10px; font-size: 12px; box-shadow: 0 6px 24px rgb(0 0 0 / 0.15); min-width: 150px; z-index: 5;
}
.tip-head { font-weight: 650; margin-bottom: 4px; }
.tip-row { display: flex; align-items: center; gap: 6px; color: var(--text-2); }
.tip-row i { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.tip-row b { margin-left: auto; padding-left: 12px; color: var(--text); font-variant-numeric: tabular-nums; }
.tip-sub { color: var(--muted); font-size: 11px; margin: 0 0 4px 14px; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px; color: var(--text-2); margin-bottom: 8px; }
.legend i { display: inline-block; width: 14px; height: 3px; border-radius: 2px; vertical-align: middle; margin-right: 6px; }
.empty { color: var(--muted); text-align: center; padding: 24px 0; margin: 0; }

.status-line { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; color: var(--muted); font-size: 13px; }
.pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--s3); display: inline-block; }
.loading { color: var(--muted); padding: 40px 0; text-align: center; }
/* merge request form */
.field-label { display: block; font-size: 13px; font-weight: 600; color: var(--text-2); margin: 14px 0 6px; }
.picker { position: relative; max-width: 420px; }
.picker input, #req-note {
  width: 100%; max-width: 420px; padding: 9px 12px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font: inherit;
}
#req-note { display: block; resize: vertical; }
#req-list { display: flex; flex-direction: column; margin-top: 4px; }
#req-list button { text-align: left; background: none; border: 0; border-radius: 6px; padding: 8px 10px; color: var(--text); font: inherit; cursor: pointer; }
#req-list button:hover { background: var(--surface-2); }
.picked { margin-top: 8px; padding: 10px 12px; border-radius: 8px; background: var(--surface-2); max-width: 420px; }
.link-btn { background: none; border: 0; color: var(--accent-ink); font: inherit; cursor: pointer; padding: 0 0 0 6px; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; }

footer { text-align: center; color: var(--muted); font-size: 12px; padding: 0 16px 32px; }

@media (max-width: 640px) {
  h1 { font-size: 24px; }
  .hero { padding: 22px 18px; }
  .hero h1 { font-size: 26px; }
  .top-tools .search { display: none; }
  .hide-sm { display: none; }
  .card { padding: 14px; }
  .table-wrap { margin: 0 -14px; padding: 0 14px; }
}
