:root {
  --bg: #f4f6f8;
  --card: #ffffff;
  --ink: #1f2a37;
  --muted: #6b7280;
  --line: #e5e7eb;
  --primary: #2c6e9b;
  --primary-soft: #cfe0ee;
  --alert: #e74c3c;
  --shadow: 0 1px 3px rgba(0, 0, 0, .08), 0 1px 2px rgba(0, 0, 0, .04);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.45;
}

header {
  background: var(--primary);
  color: #fff;
  padding: 1.1rem 1.5rem;
}
header .wrap { max-width: 1200px; margin: 0 auto; display: flex; align-items: baseline; gap: 1.5rem; flex-wrap: wrap; }
header h1 { font-size: 1.25rem; margin: 0; font-weight: 600; }
header .period { flex: 1; text-align: center; font-size: .85rem; opacity: .9; }
nav { margin-left: auto; display: flex; gap: 1rem; }
nav a { color: #fff; text-decoration: none; opacity: .8; font-size: .9rem; padding-bottom: 2px; }
nav a.active { opacity: 1; border-bottom: 2px solid #fff; }

main { max-width: 1200px; margin: 1.5rem auto; padding: 0 1.5rem 3rem; }

.kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.kpi {
  background: var(--card);
  border-radius: 10px;
  padding: 1.15rem 1.1rem;
  box-shadow: var(--shadow);
  text-align: center;
}
.kpi .label { font-size: .78rem; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.kpi .value { font-size: 2.2rem; font-weight: 700; line-height: 1.1; margin-top: .3rem; }
.kpi .sub { font-size: .8rem; color: var(--ink); opacity: .65; margin-top: .15rem; }
.kpi .delta { font-size: .8rem; color: var(--muted); margin-top: .35rem; }

.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 1.25rem; margin-bottom: 1.25rem; }

.card {
  background: var(--card);
  border-radius: 10px;
  padding: 1rem 1.1rem 1.2rem;
  box-shadow: var(--shadow);
}
.card.full { margin-bottom: 1.25rem; }
.card h2 { font-size: .98rem; margin: 0 0 .85rem; font-weight: 600; }
.card h2 .total { font-weight: 400; color: var(--muted); font-size: .85rem; }
.note { font-size: .76rem; color: var(--muted); margin: .6rem 0 0; font-style: italic; }

.legend { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem 1rem; margin-top: .7rem; font-size: .76rem; color: var(--muted); }
.legend .sw { display: inline-flex; align-items: center; gap: .35rem; }
.legend .sw i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.legend .note-inline { margin-left: auto; }
.card .chart-wrap { position: relative; height: 280px; }
.card.full .chart-wrap { height: 320px; }
.card.full .chart-wrap.tall { height: 500px; }

/* choix des courbes affichées (page Année) */
.series-picker { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .7rem; }
.series-picker button { display: inline-flex; align-items: center; gap: .35rem; border: 1px solid var(--line); background: #fff;
  color: var(--ink); font-size: .76rem; padding: .2rem .55rem; border-radius: 999px; cursor: pointer; }
.series-picker button i { width: 10px; height: 10px; border-radius: 50%; background: var(--c); display: inline-block; }
.series-picker button.off { color: var(--muted); opacity: .55; text-decoration: line-through; }
.series-picker button.off i { background: transparent; border: 1px solid var(--c); }
.series-picker button.all { color: var(--muted); border-style: dashed; }

.cumul-stats { margin-bottom: .9rem; }
.cumul-stats .mini .v { font-size: 1.3rem; }
.cumul-stats .mini.proj { background: var(--primary-soft); }
.up { color: var(--alert); }
.down { color: var(--primary); }

.toggle { display: inline-flex; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 3px; margin-bottom: 1.25rem; box-shadow: var(--shadow); }
.toggle button { border: 0; background: transparent; color: var(--muted); font-size: .85rem; padding: .4rem .9rem; border-radius: 6px; cursor: pointer; }
.toggle button.active { background: var(--primary); color: #fff; }
.toggle.small { margin-bottom: 0; }
.toggle.small button { padding: .25rem .65rem; font-size: .78rem; }

.card-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: .85rem; }
.card-head h2 { margin: 0; }

.mini-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: .9rem; }
.mini { text-align: center; padding: .6rem 0; border-radius: 8px; background: var(--bg); }
.mini .v { font-size: 1.5rem; font-weight: 650; }
.mini .l { font-size: .78rem; color: var(--muted); }

footer { max-width: 1200px; margin: 0 auto; padding: 0 1.5rem 2rem; color: var(--muted); font-size: .78rem; text-align: center; }
footer details { max-width: 560px; margin: 0 auto 1rem; }
footer summary { cursor: pointer; }
footer details table { margin-top: .5rem; font-size: .76rem; }
footer details td, footer details th { text-align: center; padding: .25rem .4rem; }

table { width: 100%; border-collapse: collapse; font-size: .86rem; }
th, td { text-align: right; padding: .45rem .6rem; border-bottom: 1px solid var(--line); }
th:first-child, td:first-child { text-align: left; }
thead th { color: var(--muted); font-weight: 600; font-size: .76rem; text-transform: uppercase; letter-spacing: .02em; }
tbody tr:hover { background: var(--bg); }
tbody tr.current td { font-weight: 600; }
td .muted { color: var(--muted); font-size: .8rem; font-weight: 400; white-space: nowrap; }

.error { background: #fde8e8; color: #9b1c1c; padding: 1rem 1.2rem; border-radius: 10px; }
.error code { background: #fff; padding: .1rem .35rem; border-radius: 4px; }
