/* Palette validée (dataviz) — rôles clairs/sombres en un seul endroit */
:root {
  --page: #f9f9f7;
  --surface-1: #fcfcfb;
  --text-primary: #0b0b0b;
  --text-secondary: #52514e;
  --text-muted: #898781;
  --grid: #e1e0d9;
  --baseline: #c3c2b7;
  --border: rgba(11, 11, 11, 0.10);
  --series-1: #2a78d6;   /* équité, PnL positif */
  --series-2: #1baf7a;   /* équité avec délai d'acceptation */
  --series-neg: #e34948; /* PnL négatif */
  --good-text: #006300;
  --bad-text: #b32222;
}
@media (prefers-color-scheme: dark) {
  :root {
    --page: #0d0d0d;
    --surface-1: #1a1a19;
    --text-primary: #ffffff;
    --text-secondary: #c3c2b7;
    --text-muted: #898781;
    --grid: #2c2c2a;
    --baseline: #383835;
    --border: rgba(255, 255, 255, 0.10);
    --series-1: #3987e5;
    --series-2: #199e70;
    --series-neg: #e66767;
    --good-text: #0ca30c;
    --bad-text: #e66767;
  }
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--page);
  color: var(--text-primary);
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif;
}
.wrap { max-width: 1180px; margin: 0 auto; padding: 20px 16px 48px; }

header { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 4px; }
header h1 { font-size: 19px; font-weight: 650; margin: 0; }
header .sub { color: var(--text-muted); font-size: 13px; }

.filters {
  display: flex; gap: 8px; flex-wrap: wrap; align-items: center;
  margin: 12px 0 16px;
}
.filters select, .filters input[type="search"] {
  background: var(--surface-1); color: var(--text-primary);
  border: 1px solid var(--border); border-radius: 8px;
  padding: 6px 10px; font: inherit;
}
.filters label { color: var(--text-secondary); font-size: 13px; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 16px; }
.tile {
  background: var(--surface-1); border: 1px solid var(--border);
  border-radius: 12px; padding: 12px 14px;
}
.tile .label { color: var(--text-secondary); font-size: 12.5px; }
.tile .value { font-size: 24px; font-weight: 600; margin-top: 2px; }
.tile.hero { grid-column: span 2; }
.tile.hero .value { font-size: 48px; font-weight: 650; line-height: 1.1; }
@media (max-width: 560px) { .tile.hero { grid-column: auto; } .tile.hero .value { font-size: 34px; } }
.tile .delta { font-size: 12.5px; margin-top: 2px; }
.delta.up { color: var(--good-text); }
.delta.down { color: var(--bad-text); }
.delta.flat { color: var(--text-muted); }

.charts { display: grid; grid-template-columns: 3fr 2fr; gap: 10px; margin-bottom: 16px; }
@media (max-width: 900px) { .charts { grid-template-columns: 1fr; } }
.card {
  background: var(--surface-1); border: 1px solid var(--border);
  border-radius: 12px; padding: 14px;
}
.card h2 { font-size: 14px; font-weight: 600; margin: 0 0 4px; }
.card .hint { color: var(--text-muted); font-size: 12px; margin: 0 0 8px; }
.card svg { display: block; width: 100%; }
.card .head-row { display: flex; justify-content: space-between; align-items: center; }

.legend { display: flex; gap: 14px; align-items: center; margin: 0 0 6px; font-size: 12px; color: var(--text-secondary); }
.legend .key { display: inline-flex; align-items: center; gap: 5px; }
.legend .swatch { width: 14px; height: 3px; border-radius: 2px; display: inline-block; }

.tooltip {
  position: fixed; pointer-events: none; z-index: 30; display: none;
  background: var(--surface-1); border: 1px solid var(--border);
  border-radius: 8px; padding: 7px 10px; font-size: 12.5px;
  box-shadow: 0 4px 14px rgba(0,0,0,.14); color: var(--text-primary);
  white-space: nowrap;
}
.tooltip .t-label { color: var(--text-secondary); }
.tooltip .t-value { font-weight: 600; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 7px 9px; border-bottom: 1px solid var(--grid); }
th {
  color: var(--text-secondary); font-weight: 600; font-size: 12px;
  cursor: pointer; user-select: none; white-space: nowrap;
}
th .arrow { color: var(--text-muted); font-size: 10px; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr:hover td { background: color-mix(in srgb, var(--series-1) 6%, transparent); }
.pnl-pos { color: var(--good-text); font-weight: 600; }
.pnl-neg { color: var(--bad-text); font-weight: 600; }

.chip {
  display: inline-block; padding: 1px 8px; border-radius: 99px;
  font-size: 11.5px; font-weight: 600; border: 1px solid var(--border);
}
.chip.won  { color: var(--good-text); }
.chip.lost { color: var(--bad-text); }
.chip.open { color: var(--series-1); }
.chip.void { color: var(--text-muted); }
.chip.mode { color: var(--text-muted); font-weight: 500; }

.live-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; }
.live-card { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; }
.live-card .teams { font-weight: 600; }
.live-card .score { font-size: 20px; font-weight: 650; font-variant-numeric: tabular-nums; }
.live-card .meta { color: var(--text-muted); font-size: 12px; }
.empty { color: var(--text-muted); padding: 12px 0; }

.pager { display: flex; gap: 8px; align-items: center; margin-top: 10px; color: var(--text-secondary); font-size: 13px; }
.pager button {
  background: var(--surface-1); border: 1px solid var(--border); color: var(--text-primary);
  border-radius: 8px; padding: 4px 12px; font: inherit; cursor: pointer;
}
.pager button:disabled { opacity: .4; cursor: default; }
section { margin-bottom: 16px; }
