:root {
  color-scheme: light;
  --bg: #f5f5f5;
  --surface: #ffffff;
  --surface-2: #efefef;
  --ink: #161616;
  --ink-2: #5c5c5c;
  --ink-3: #8f8f8f;
  --line: #e4e4e4;
  --grid: #ececec;
  --accent: #3d3d3d;
  --accent-ink: #ffffff;
  --lime: #c8f560;
  --bloc-izquierda: #e5484d;
  --bloc-centro: #d98a00;
  --bloc-derecha: #2f6fdb;
  --bloc-otros: #a3a3a3;
  --shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 8px 30px rgba(0, 0, 0, .06);
  --radius: 22px;
  font-family: "Noto Sans", system-ui, sans-serif;
  font-weight: 300;
  font-synthesis: none;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0f0f0f;
    --surface: #1a1a1a;
    --surface-2: #242424;
    --ink: #f2f2f2;
    --ink-2: #b3b3b3;
    --ink-3: #808080;
    --line: #2e2e2e;
    --grid: #272727;
    --accent: #d6d6d6;
    --accent-ink: #161616;
    --bloc-izquierda: #ef5a5f;
    --bloc-centro: #cf8d10;
    --bloc-derecha: #4f86ec;
    --bloc-otros: #707070;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 30px rgba(0, 0, 0, .25);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f0f0f;
  --surface: #1a1a1a;
  --surface-2: #242424;
  --ink: #f2f2f2;
  --ink-2: #b3b3b3;
  --ink-3: #808080;
  --line: #2e2e2e;
  --grid: #272727;
  --accent: #d6d6d6;
  --accent-ink: #161616;
  --bloc-izquierda: #ef5a5f;
  --bloc-centro: #cf8d10;
  --bloc-derecha: #4f86ec;
  --bloc-otros: #707070;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 30px rgba(0, 0, 0, .25);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.45;
  min-height: 100vh;
  overflow-x: hidden;
}


.top, .filters, main { max-width: 1180px; margin: 0 auto; padding: 0 20px; }

.top { display: flex; align-items: center; justify-content: space-between; padding-top: 28px; padding-bottom: 18px; gap: 16px; }
.brand { display: flex; align-items: center; gap: 14px; }
.logo { width: 52px; height: 52px; display: block; flex: none; }
.logo img { width: 100%; height: 100%; display: block; }
h1 { margin: 0; font-size: clamp(30px, 5vw, 44px); font-weight: 100; letter-spacing: -.02em; line-height: 1; }
.tagline { margin: 4px 0 0; color: var(--ink-2); }

.theme-toggle {
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  width: 44px; height: 44px; border-radius: 14px; font-size: 18px; cursor: pointer;
}
.theme-toggle .moon { display: none; }
:root[data-theme="dark"] .theme-toggle .sun { display: none; }
:root[data-theme="dark"] .theme-toggle .moon { display: inline; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .sun { display: none; }
  :root:not([data-theme="light"]) .theme-toggle .moon { display: inline; }
}

/* Filters */
.filters {
  position: relative; z-index: 10; padding-top: 12px; padding-bottom: 12px;
  display: grid; gap: 12px;
}
.filter-row { display: flex; flex-wrap: wrap; gap: 10px; }
.filter-label { font-size: 12px; font-weight: 300; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-2); margin-bottom: 6px; }
.filter-label .hint { text-transform: none; letter-spacing: 0; font-weight: 300; color: var(--ink-3); margin-left: 6px; }

.seg { display: inline-flex; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 3px; }
.seg button {
  border: 0; background: transparent; color: var(--ink-2); font: inherit; font-weight: 300;
  padding: 7px 14px; border-radius: 11px; cursor: pointer;
}
.seg button[aria-checked="true"], .seg button[aria-pressed="true"] { background: var(--ink); color: var(--bg); }
#metric button[aria-pressed="true"] + button[aria-pressed="true"] { margin-left: 2px; }
.seg button:disabled { opacity: .35; cursor: not-allowed; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; font-weight: 300;
  padding: 6px 12px; border-radius: 999px; cursor: pointer; font-size: 14px;
  transition: transform .12s ease;
}
.chip:hover { transform: translateY(-1px); }
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.chip .tag { font-size: 11px; font-weight: 300; margin-left: 4px; opacity: .75; }

.place { display: flex; flex-wrap: wrap; gap: 8px; }
.field { display: grid; gap: 3px; font-size: 12px; color: var(--ink-2); font-weight: 300; min-width: 150px; }
.field.grow { flex: 1 1 220px; }
.field select, .field input {
  font: inherit; font-size: 14px; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px; min-width: 0; width: 100%;
}
.field select:disabled { opacity: .5; }

.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin-top: 8px; font-size: 14px; }
.crumbs button {
  font: inherit; border: 0; background: var(--surface-2); color: var(--ink); padding: 3px 10px; border-radius: 999px; cursor: pointer;
}
.crumbs button:last-child { background: var(--lime); color: #161616; font-weight: 300; }
.crumbs .sep { color: var(--ink-3); }

main { padding-top: 20px; padding-bottom: 40px; display: grid; gap: 18px; }

/* Tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.tile {
  background: var(--surface); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow);
  border: 1px solid var(--line); display: grid; gap: 6px; position: relative; overflow: hidden;
}
.tile .when { font-weight: 300; font-size: 13px; color: var(--ink-2); display: flex; justify-content: space-between; gap: 8px; }
.tile .big { font-size: 38px; font-weight: 100; letter-spacing: -.02em; line-height: 1; }
.tile .big small { font-size: 14px; font-weight: 300; color: var(--ink-2); letter-spacing: 0; margin-left: 4px; }
.tile .row { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; color: var(--ink-2); }
.tile .row b { color: var(--ink); font-weight: 300; }
.winner { display: inline-flex; align-items: center; gap: 6px; font-weight: 300; color: var(--ink); }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; }
.tile.missing { color: var(--ink-3); }
.badge { font-size: 11px; font-weight: 300; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); }
.badge.prov { background: var(--lime); color: #161616; }

/* Cards */
[hidden] { display: none !important; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); min-width: 0; }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 8px; }
h2 { margin: 0; font-size: 24px; font-weight: 100; letter-spacing: -.01em; }
.sub { margin: 2px 0 0; color: var(--ink-2); font-size: 13px; }
.ghost { font: inherit; font-weight: 300; font-size: 13px; border: 1px solid var(--line); background: transparent; color: var(--ink); padding: 6px 12px; border-radius: 999px; cursor: pointer; white-space: nowrap; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 860px) { .grid2 { grid-template-columns: 1fr; } }

.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13px; color: var(--ink-2); margin: 4px 0 10px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend .swatch-line { width: 18px; height: 2px; border-radius: 1px; background: var(--ink); display: inline-block; }
.legend .swatch { width: 18px; height: 10px; border-radius: 3px; background: var(--ink); display: inline-block; }

.chart { width: 100%; position: relative; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart text { font-family: inherit; fill: var(--ink-2); font-size: 12px; }
.chart .label-strong { fill: var(--ink); font-weight: 300; font-size: 13px; }
.chart .muted { fill: var(--ink-3); }
.chart .grid line { stroke: var(--grid); stroke-width: 1; }
.chart .axis line { stroke: var(--line); }
.chart .hit { fill: transparent; cursor: pointer; }
.chart .hit:focus { outline: none; }
.chart .hit:focus-visible + .mark, .chart .mark.active { stroke: var(--ink); stroke-width: 1.5; }
.chart .seats-line { stroke: var(--ink); stroke-width: 2; stroke-linecap: round; pointer-events: none; }
.chart .seats-line.end { stroke-width: 2.5; }
.empty { color: var(--ink-3); padding: 24px 0; text-align: center; }

.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 13px; font-variant-numeric: tabular-nums; }
th, td { padding: 7px 10px; text-align: right; border-bottom: 1px solid var(--line); white-space: nowrap; }
th:first-child, td:first-child { text-align: left; position: sticky; left: 0; background: var(--surface); }
thead th { color: var(--ink-2); font-weight: 300; font-size: 12px; }
thead tr:first-child th { font-size: 13px; color: var(--ink); }
tbody tr.total td { color: var(--ink-2); }
td .pname { display: inline-flex; align-items: center; gap: 6px; font-weight: 300; }

.notes { color: var(--ink-3); font-size: 12px; line-height: 1.6; padding: 4px 4px 0; }
.notes p { margin: 0 0 4px; }

.tooltip {
  position: fixed; z-index: 50; pointer-events: none; opacity: 0; transform: translateY(4px);
  transition: opacity .1s ease, transform .1s ease;
  background: var(--ink); color: var(--bg); border-radius: 12px; padding: 8px 11px; font-size: 13px;
  max-width: 280px; box-shadow: 0 10px 30px rgba(0,0,0,.2);
}
.tooltip.show { opacity: 1; transform: none; }
.tooltip .t-title { font-weight: 300; margin-bottom: 2px; }
.tooltip .t-row { display: flex; justify-content: space-between; gap: 14px; font-variant-numeric: tabular-nums; }
.tooltip .t-row span:first-child { display: inline-flex; align-items: center; gap: 6px; opacity: .85; }

.loading main { opacity: .55; transition: opacity .15s; }

@media (max-width: 600px) {
  .top, .filters, main { padding-left: 16px; padding-right: 16px; }
  .field { min-width: calc(50% - 4px); flex: 1 1 calc(50% - 4px); }
  .card { padding: 16px; }
}
