/* Page d'administration (/admin) : statistiques du site et gestion du jeu. Mêmes couleurs et police que le jeu. */
@font-face {
  font-family: Inter;
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url("/fonts/inter-latin-wght-normal.woff2") format("woff2-variations");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
    U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: Inter;
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url("/fonts/inter-latin-ext-wght-normal.woff2") format("woff2-variations");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329,
    U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --bg: #f9f8f6;
  --surface: #ffffff;
  --line: #e7e5e0;
  --line-strong: #d6d3cc;
  --ink: #1d1c19;
  --muted: #6f6d68;
  --accent: #2d5bff;
  --accent-soft: #c3d0ff; /* « déjà venus » dans le graphique : l'accent éclairci */
  --track: #efede8;
  --danger-text: #cd2b31;
  --radius: 10px;
  color-scheme: light;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 0 16px 72px;
  background: var(--bg);
  color: var(--ink);
  font: 400 14px/1.5 Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

[hidden] { display: none !important; }
a { color: var(--accent); }
h1, h2, h3, h4 { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 12px; line-height: 1.45; }
.tag { color: var(--accent); font-size: 11px; font-weight: 600; }

/* ---------- En-tête ---------- */

.top-inner,
main,
.state { max-width: 1040px; margin: 0 auto; }

.top-inner { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 20px; padding: 18px 0 6px; }
.back { flex-basis: 100%; color: var(--muted); font-size: 13px; text-decoration: none; }
.back:hover { color: var(--ink); }
h1 { display: flex; align-items: center; gap: 10px; font-size: 24px; font-weight: 600; letter-spacing: -0.02em; }
.role { padding: 2px 8px; border-radius: 999px; background: #e8edff; color: var(--accent); font-size: 12px; font-weight: 600; letter-spacing: 0; }
.jump { display: flex; align-items: center; gap: 16px; margin-left: auto; font-size: 13px; }
.jump-links { display: flex; gap: 16px; }
.jump a { color: var(--ink); text-decoration: none; }
.jump a:hover { color: var(--accent); }
.lang-switch { padding: 0; border: 0; background: none; color: var(--muted); font: inherit; text-decoration: underline; cursor: pointer; }

.state { margin-top: 40px; padding: 28px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); color: var(--muted); text-align: center; }

/* ---------- Blocs et cartes ---------- */

.block { margin-top: 28px; scroll-margin-top: 16px; }
.block-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; margin-bottom: 12px; }
h2 { font-size: 19px; font-weight: 600; letter-spacing: -0.01em; }
.block-head button { margin-left: auto; }
.block-head button + button { margin-left: 0; }

.card { margin-top: 14px; padding: 18px 20px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
figure.card { margin-inline: 0; }
.card-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; margin-bottom: 10px; }
h3 { font-size: 15px; font-weight: 600; }
h4 { margin: 18px 0 6px; color: var(--muted); font-size: 12px; font-weight: 600; }
.card > h3 { margin-bottom: 12px; }
.card > p { margin: 8px 0 0; }

.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; gap: 0 14px; }

/* ---------- Chiffres ---------- */

.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.tile { min-width: 0; padding: 14px 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.tile strong { display: block; font-size: 28px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.15; font-variant-numeric: tabular-nums; }
.tile span { display: block; margin-top: 2px; font-size: 13px; font-weight: 500; }
.tile small { display: block; color: var(--muted); font-size: 12px; }

/* ---------- Graphique des jours (js/admin-stats.js, SVG) ---------- */

.legend { display: flex; gap: 14px; margin: 0; color: var(--muted); font-size: 12px; }
.legend > span { display: inline-flex; align-items: center; gap: 6px; }
.key { display: inline-block; width: 10px; height: 10px; border-radius: 3px; }
.key-new { background: var(--accent); }
.key-back { background: var(--accent-soft); }

.chart-detail { min-height: 2.9em; margin: 0 0 6px; font-size: 13px; }
.chart-detail strong { font-weight: 600; }
.chart { position: relative; }
.chart svg { display: block; width: 100%; height: auto; touch-action: pan-y; cursor: crosshair; }
.chart svg:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 4px; }
.chart .grid-line { stroke: var(--line); stroke-width: 1; }
.chart .axis { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart .back { fill: var(--accent-soft); }
.chart .new { fill: var(--accent); }
.chart .hit { fill: transparent; }
.chart .outline { fill: none; stroke: var(--accent); stroke-width: 1; stroke-dasharray: 3 2; }
.chart .picking .bar:not(.on) :is(.back, .new) { opacity: 0.45; }

/* ---------- Thèmes en barres ---------- */

.segmented { display: inline-flex; padding: 3px; border-radius: 9px; background: #f1f0ec; }
.segmented label { position: relative; padding: 5px 12px; border-radius: 7px; color: var(--muted); font-size: 13px; font-weight: 500; cursor: pointer; }
.segmented input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.segmented label:has(input:checked) { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(29, 28, 25, 0.08); }
.segmented label:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 1px; }
.card .segmented { margin-bottom: 10px; }
.card-head .segmented { margin: 0; }

.bars { margin: 0; padding: 0; list-style: none; }
.bars li { padding: 8px 0; }
.bars li + li { border-top: 1px solid var(--line); }
.bar-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.bar-name { min-width: 0; font-weight: 500; overflow-wrap: anywhere; }
.bar-value { flex: none; font-weight: 600; font-variant-numeric: tabular-nums; }
.bar-track { height: 8px; margin: 6px 0 4px; border-radius: 4px; background: var(--track); overflow: hidden; }
.bar-fill { height: 100%; min-width: 2px; border-radius: 4px; background: var(--accent); }
.bar-sub { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }

/* ---------- Tous les jours ---------- */

summary { font-size: 15px; font-weight: 600; cursor: pointer; }
details[open] summary { margin-bottom: 10px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { padding: 6px 8px; border-bottom: 1px solid var(--line-strong); color: var(--muted); font-size: 12px; font-weight: 600; text-align: left; }
td { padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
:is(th, td):first-child { padding-left: 0; white-space: nowrap; }
:is(th, td):last-child { padding-right: 0; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
td .tag { display: block; }

/* ---------- Gestion ---------- */

.row { display: flex; gap: 8px; margin: 0; }
select,
input:not([type]) {
  flex: 1;
  min-width: 0;
  height: 40px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
}

button { font: inherit; }
.row button,
.ghost {
  flex: none;
  height: 40px;
  padding: 0 14px;
  border: 0;
  border-radius: var(--radius);
  background: var(--accent);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.row button.danger { background: var(--danger-text); }
.ghost { height: 34px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); }
.ghost:hover { border-color: var(--ink); }
button:disabled { opacity: 0.5; cursor: default; }

.list { margin: 0; padding: 0; list-style: none; }
.list li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 5px 0; }
.list li + li { border-top: 1px solid var(--line); }
.list li.none { color: var(--muted); }
.list button { padding: 0; border: 0; background: none; color: var(--accent); font-size: 12px; cursor: pointer; }
#admin-upcoming li { justify-content: flex-start; }
#admin-upcoming .day { flex: none; min-width: 92px; color: var(--muted); font-variant-numeric: tabular-nums; }
#admin-upcoming small { color: var(--muted); font-size: 12px; }

.check { display: flex; align-items: flex-start; gap: 10px; font-weight: 500; cursor: pointer; }
.check input { flex: none; width: 18px; height: 18px; margin: 1px 0 0; accent-color: var(--accent); cursor: pointer; }
.check small { display: block; color: var(--muted); font-size: 12px; font-weight: 400; }

:is(a, button, select, input):focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Messages ---------- */

.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  z-index: 10;
  max-width: calc(100% - 32px);
  margin: 0;
  padding: 10px 16px;
  border-radius: var(--radius);
  background: var(--ink);
  color: #fff;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 8px);
  transition: opacity 0.2s, transform 0.2s;
}

.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: var(--danger-text); }

/* ---------- Téléphone ---------- */

@media (max-width: 760px) {
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .tile { padding: 12px 14px; }
  .tile strong { font-size: 24px; }
  .grid { grid-template-columns: minmax(0, 1fr); }
  .card { padding: 16px; }
  .jump { flex-basis: 100%; margin-left: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .toast { transition: none; }
}
