/* Administration — même esprit que le site (Apple HIG), en plus sobre. */

:root {
  --accent: #c1121f;
  --accent-hover: #a10f1a;
  --blue: #0066cc;
  --bg: #f5f5f7;
  --surface: #ffffff;
  --text: #1d1d1f;
  --text-2: #6e6e73;
  --line: rgba(0, 0, 0, .1);
  --field: #ffffff;
  --green: #1d7d36;
  --orange: #a35200;
  --radius: 14px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --accent: #ff6b6b;
    --accent-hover: #ff8787;
    --blue: #4da3ff;
    --bg: #000000;
    --surface: #1c1c1e;
    --text: #f5f5f7;
    --text-2: #a1a1a6;
    --line: rgba(255, 255, 255, .14);
    --field: #2c2c2e;
    --green: #4cd964;
    --orange: #ffb340;
  }
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; font-family: var(--font); font-size: 16px; line-height: 1.5; color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--blue) 55%, transparent); outline-offset: 2px; border-radius: 6px; }
code { font-size: .9em; background: var(--line); padding: 1px 5px; border-radius: 5px; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--text-2); }

/* Barre du haut */
.admin-bar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 8px 24px; flex-wrap: wrap;
  padding: 0 max(16px, env(safe-area-inset-left)); min-height: 56px;
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--line);
}
.admin-bar__brand { font-weight: 700; color: var(--text); font-size: 17px; }
.admin-bar__brand span { color: var(--accent); font-weight: 600; }
.admin-bar__nav { display: flex; gap: 4px; flex-wrap: wrap; }
.admin-bar__nav a { color: var(--text); padding: 10px 12px; border-radius: 10px; min-height: 44px; display: inline-flex; align-items: center; font-size: 15px; }
.admin-bar__nav a:hover { background: var(--line); text-decoration: none; }
.admin-bar__nav a[aria-current="page"] { background: var(--line); font-weight: 600; }
.admin-bar__user { margin-left: auto; display: flex; align-items: center; gap: 16px; font-size: 15px; }
.admin-bar__user form { margin: 0; }
.link-button { background: none; border: 0; padding: 0; min-height: 44px; font: inherit; color: var(--blue); cursor: pointer; }
@media (max-width: 700px) {
  .admin-bar { padding-block: 8px; }
  .admin-bar__user { margin-left: 0; width: 100%; justify-content: space-between; }
}

.admin-main { width: min(100% - 32px, 860px); margin: 32px auto 80px; }
.admin-main--narrow { width: min(100% - 32px, 400px); margin-top: 12vh; }

.page-title { font-size: clamp(28px, 4vw, 34px); line-height: 1.15; letter-spacing: -.015em; margin: 0 0 6px; }
.section-title { font-size: 20px; margin: 36px 0 10px; }
.breadcrumb { margin: 0 0 12px; }
.breadcrumb a { display: inline-flex; align-items: center; min-height: 44px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px 24px; flex-wrap: wrap; margin-bottom: 24px; }
.page-head .muted { margin: 4px 0 0; }
.page-head__links { display: flex; gap: 20px; }
.page-head__links a { min-height: 44px; display: inline-flex; align-items: center; }

/* Messages */
.notice { padding: 12px 16px; border-radius: 12px; margin: 0 0 20px; font-weight: 500; }
.notice--success { background: color-mix(in srgb, var(--green) 14%, transparent); color: var(--green); }
.notice--error { background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--accent); }

.badge { display: inline-block; padding: 2px 10px; border-radius: 980px; font-size: 13px; font-weight: 600; white-space: nowrap; }
.badge--green { background: color-mix(in srgb, var(--green) 15%, transparent); color: var(--green); }
.badge--orange { background: color-mix(in srgb, var(--orange) 16%, transparent); color: var(--orange); }
.badge--grey { background: var(--line); color: var(--text-2); }

/* Listes façon Réglages iOS */
.list { list-style: none; margin: 20px 0 0; padding: 0; background: var(--surface); border-radius: var(--radius); overflow: hidden; }
.list > li + li { border-top: 1px solid var(--line); }
.list__row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; min-height: 56px; color: var(--text); }
a.list__row:hover { background: color-mix(in srgb, var(--line) 50%, transparent); text-decoration: none; }
.list__main { display: flex; flex-direction: column; min-width: 0; }
.list__main .muted { font-size: 14px; }
.list__meta { display: flex; align-items: center; gap: 12px; font-size: 14px; flex-shrink: 0; }
.chevron { color: var(--text-2); opacity: .6; }
@media (max-width: 600px) {
  .list__meta .muted { display: none; }
}

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); gap: 16px; margin-top: 24px; }
.tile { display: flex; flex-direction: column; gap: 4px; padding: 20px; background: var(--surface); border-radius: var(--radius); color: var(--text); }
.tile:hover { text-decoration: none; box-shadow: 0 0 0 2px var(--blue); }
.tile__title { color: var(--text-2); font-size: 14px; font-weight: 600; }
.tile__value { font-size: 22px; font-weight: 700; }
.tile__hint { color: var(--text-2); font-size: 14px; }

/* Formulaires */
.form { display: flex; flex-direction: column; gap: 20px; }
.group { background: var(--surface); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 16px; }
.group--details { padding: 0; }
.group--details summary { padding: 14px 16px; min-height: 48px; cursor: pointer; font-weight: 600; }
.group--details[open] { padding-bottom: 16px; }
.group--details .field { padding: 0 16px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label, .field .label { font-weight: 600; font-size: 15px; }
.optional { font-weight: 400; color: var(--text-2); font-size: 13px; margin-left: 4px; }
.hint { margin: 0; color: var(--text-2); font-size: 14px; }
.field__error { margin: 0; color: var(--accent); font-size: 14px; font-weight: 500; }
.field--error input, .field--error textarea { box-shadow: inset 0 0 0 2px var(--accent); }

input[type="text"], input[type="email"], input[type="password"], input[type="url"], input[type="number"], input[type="date"], input[type="time"], input[type="datetime-local"], textarea, select {
  width: 100%; font: inherit; font-size: 16px; /* 16 px : pas de zoom automatique sur iPhone */
  color: var(--text); background: var(--field);
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; min-height: 44px;
}
textarea { resize: vertical; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px color-mix(in srgb, var(--blue) 25%, transparent); }

.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 10px 20px; border-radius: 980px; border: 0;
  background: var(--blue); color: #fff; font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.button:hover { filter: brightness(1.08); text-decoration: none; }
.button--plain { background: color-mix(in srgb, var(--blue) 12%, transparent); color: var(--blue); }
.button--small { min-height: 36px; padding: 6px 14px; font-size: 14px; }
.button--block { width: 100%; }

.actions {
  position: sticky; bottom: 0; z-index: 5;
  display: flex; gap: 12px; align-items: center; flex-wrap: wrap;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); margin: 0 -16px;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px);
  border-top: 1px solid var(--line);
}
.actions--end { justify-content: flex-end; }
.field--inline { flex: 1 1 260px; }
.actions__buttons { display: flex; gap: 8px; flex-wrap: wrap; margin-left: auto; }
@media (max-width: 600px) {
  .actions__buttons { width: 100%; }
  .actions__buttons .button { flex: 1; }
}

/* Éditeur */
.editor { background: var(--surface); border-radius: var(--radius); border: 1px solid var(--line); overflow: clip; }
.editor:focus-within { border-color: var(--blue); box-shadow: 0 0 0 3px color-mix(in srgb, var(--blue) 25%, transparent); }
.editor__toolbar {
  position: sticky; top: 56px; z-index: 4;
  display: flex; flex-wrap: wrap; gap: 4px; align-items: center;
  padding: 6px; border-bottom: 1px solid var(--line); background: var(--surface);
}
.editor__toolbar button {
  min-height: 40px; min-width: 40px; padding: 6px 10px; border-radius: 8px; border: 0;
  background: transparent; color: var(--text); font: inherit; font-size: 14px; cursor: pointer;
}
.editor__toolbar button:hover { background: var(--line); }
.editor__toolbar button[aria-pressed="true"] { background: color-mix(in srgb, var(--blue) 16%, transparent); color: var(--blue); }
.editor__sep { width: 1px; height: 24px; background: var(--line); margin: 0 4px; }
.editor__insert select { min-height: 40px; width: auto; font-size: 14px; padding: 6px 8px; }
.editor__area { min-height: 360px; padding: 20px; outline: none; font-size: 17px; line-height: 1.6; }
.editor--compact .editor__area { min-height: 140px; }

/* Aperçu du texte dans l'éditeur : proche du rendu public */
.prose > :first-child { margin-top: 0; }
.prose h2 { font-size: 22px; margin: 28px 0 8px; padding-top: 16px; border-top: 1px dashed var(--line); }
.prose h2:first-child { border-top: 0; padding-top: 0; }
.prose h3 { font-size: 18px; margin: 20px 0 6px; }
.prose p { margin: 0 0 12px; }
.prose ul, .prose ol { margin: 0 0 12px; padding-left: 1.4em; }
.prose blockquote { margin: 12px 0; padding: 12px 16px; border-radius: 10px; background: color-mix(in srgb, var(--accent) 8%, transparent); border-left: 4px solid var(--accent); }
.prose a { text-decoration: underline; }

/* Connexion */
.login { text-align: center; }
.login__logo { border-radius: 14px; }
.login h1 { margin: 12px 0 0; font-size: 28px; }
.login .muted { margin: 0 0 24px; }
.login .form { text-align: left; background: var(--surface); padding: 20px; border-radius: var(--radius); }

/* Formulaires courts sur une ligne */
.form-inline { flex-direction: row; align-items: flex-end; flex-wrap: wrap; margin: 20px 0; }
.form-inline .field { flex: 1 1 220px; }
input[type="file"] { font: inherit; font-size: 15px; min-height: 44px; padding: 8px 0; max-width: 100%; }
.check { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; font-size: 15px; }
.check input { width: 20px; height: 20px; }
.link-button--danger { color: var(--accent); }
.button--danger { color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); }
.danger-zone { margin: 40px 0 0; padding-top: 12px; border-top: 1px solid var(--line); }
.page-head > .button { align-self: center; }

/* Sponsors */
.sponsor-rows { display: flex; flex-direction: column; gap: 12px; }
.sponsor-row { display: grid; grid-template-columns: 120px 1fr auto; gap: 16px; align-items: center; background: var(--surface); border-radius: var(--radius); padding: 14px 16px; }
.sponsor-row--off { opacity: .6; }
.sponsor-row__logo { background: #fff; border-radius: 10px; height: 80px; display: flex; align-items: center; justify-content: center; padding: 8px; }
.sponsor-row__logo img { max-width: 100%; max-height: 100%; object-fit: contain; }
.sponsor-row__form { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 12px; align-items: end; }
.sponsor-row form:last-child { margin: 0; }
@media (max-width: 800px) {
  .sponsor-row { grid-template-columns: 1fr; }
  .sponsor-row__form { grid-template-columns: 1fr; }
}

/* Photos */
.album-row { display: flex; align-items: center; gap: 14px; }
.album-row__cover { width: 64px; height: 48px; border-radius: 8px; overflow: hidden; background: var(--line); flex-shrink: 0; }
.album-row__cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.upload-progress progress { width: 100%; height: 8px; accent-color: var(--blue); }
.admin-photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; margin: 24px 0; }
.admin-photo { position: relative; aspect-ratio: 1; border-radius: 10px; overflow: hidden; background: var(--line); }
.admin-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.admin-photo--cover { outline: 3px solid var(--green); outline-offset: -3px; }
.admin-photo__check { position: absolute; top: 0; left: 0; width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.admin-photo__check input { width: 22px; height: 22px; }
.admin-photo__cover { position: absolute; left: 6px; right: 6px; bottom: 6px; min-height: 32px; border: 0; border-radius: 8px; background: rgba(0,0,0,.55); color: #fff; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.admin-photo__cover:hover, .admin-photo__cover:focus-visible { background: rgba(0,0,0,.85); }
.admin-photo__badge { position: absolute; left: 6px; right: 6px; bottom: 6px; min-height: 32px; display: flex; align-items: center; justify-content: center; border-radius: 8px; background: var(--green); color: #fff; font-size: 13px; font-weight: 700; }
.admin-photo--cover { outline-width: 4px; }

/* Bénévoles */
.count-pill { display: inline-flex; align-items: center; justify-content: center; min-width: 32px; height: 32px; padding: 0 8px; border-radius: 16px; background: color-mix(in srgb, var(--blue) 14%, transparent); color: var(--blue); font-weight: 700; }
.signups { display: flex; flex-direction: column; gap: 12px; }
.signup { background: var(--surface); border-radius: var(--radius); padding: 14px 16px; }
.signup__head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.signup__head form { margin: 0; }
.signup__contact { display: flex; gap: 4px 20px; flex-wrap: wrap; margin: 2px 0 8px; }
.signup__contact a { min-height: 44px; display: inline-flex; align-items: center; }
.signup__slots { margin: 0 0 8px; padding-left: 1.2em; font-size: 15px; }
.signup__note { margin: 0; padding: 10px 12px; background: var(--bg); border-radius: 10px; font-size: 15px; overflow-wrap: anywhere; }
.slot-row { display: flex; gap: 16px; align-items: center; background: var(--surface); border-radius: var(--radius); padding: 14px 16px; flex-wrap: wrap; }
.slot-row form:last-child { margin: 0; }
.slot-row__form { flex: 1 1 500px; display: grid; grid-template-columns: 130px 250px minmax(0, 1fr) auto auto; gap: 10px 12px; align-items: end; }
.slot-row__used { font-size: 14px; }
@media (max-width: 800px) { .slot-row__form { grid-template-columns: 1fr; } }

.group-title { font-size: 17px; margin: 0 0 4px; }
.group .muted { margin: 0; }
.login__link { margin: 16px 0 0; }
.login__link a { display: inline-flex; align-items: center; min-height: 44px; }

/* Course : catégories et tarifs */
.subnav { display: flex; gap: 8px; flex-wrap: wrap; margin: 16px 0 0; }
.subnav a { background: var(--surface); border-radius: 999px; padding: 8px 14px; font-weight: 600; font-size: 15px; }
.help { background: color-mix(in srgb, var(--blue) 8%, var(--surface)); border-radius: var(--radius); padding: 12px 16px; font-size: 15px; }
.help p { margin: 0; }
.cat-row { background: var(--surface); border-radius: var(--radius); padding: 14px 16px; display: grid; gap: 12px; scroll-margin-top: 90px; }
.cat-row--new { margin: 16px 0; border: 2px dashed var(--line); }
.cat-row--new > .button { justify-self: start; }
.cat-row__title { margin: 0; font-weight: 700; }
.cat-row__head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 14px; }
.cat-row__head img { background: #fff; border-radius: 8px; object-fit: contain; }
.cat-row__code { font-size: 20px; }
.cat-row__view { margin-left: auto; font-size: 14px; }
.cat-row__form { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px 12px; align-items: end; }
.cat-row__actions { display: flex; align-items: center; gap: 16px; }
.cat-row__actions form { margin: 0; }
.cat-row__name { grid-column: span 5; }
.cat-row__icon { grid-column: span 2; }
@media (max-width: 700px) { .cat-row__form { grid-template-columns: repeat(2, minmax(0, 1fr)); } .cat-row__name, .cat-row__icon { grid-column: 1 / -1; } }
.route-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.route-box { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; margin: 0; display: grid; gap: 10px; min-width: 0; }
.route-box legend { font-weight: 700; font-size: 18px; padding: 0 6px; }
.small { font-size: 14px; }
.route-box input, .route-box select, .cat-row__form input, .cat-row__form select { width: 100%; min-width: 0; max-width: 100%; box-sizing: border-box; }
.route-box input[type="file"] { font-size: 14px; }
.gpx-box { display: grid; gap: 10px; background: color-mix(in srgb, var(--line) 35%, transparent); border-radius: 12px; padding: 12px; }
.gpx-box__title { margin: 0; font-weight: 700; font-size: 15px; }
.gpx-box__current { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 2px 10px; background: var(--surface); border-radius: 10px; padding: 8px 10px; min-width: 0; }
.gpx-box__icon { flex: none; font: 800 11px/1 system-ui; letter-spacing: .04em; color: #fff; background: #2E7D32; border-radius: 6px; padding: 6px 5px; }
.gpx-box__name { min-width: 0; font-size: 14px; font-weight: 600; overflow-wrap: anywhere; line-height: 1.3; }
.gpx-box__name em { color: var(--accent); font-style: normal; }
.gpx-box__icon { grid-row: span 2; }
.gpx-box__current a { grid-column: 2; font-size: 13px; }
.gpx-box__drop { position: relative; display: block; border: 2px dashed color-mix(in srgb, var(--blue) 45%, transparent); border-radius: 10px; padding: 10px 12px; cursor: pointer; background: var(--surface); }
.gpx-box__drop:hover, .gpx-box__drop:focus-within { border-color: var(--blue); }
.gpx-box__drop.is-set { border-style: solid; border-color: var(--blue); background: color-mix(in srgb, var(--blue) 8%, var(--surface)); }
.gpx-box__drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100% !important; }
.gpx-box__drop b { display: block; color: var(--blue); font-size: 15px; overflow-wrap: anywhere; }
.gpx-box__drop small { display: block; color: var(--text-2); font-size: 13px; }
.switch { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 12px; align-items: center; cursor: pointer; padding: 4px 0; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch__track { position: relative; width: 44px; height: 26px; border-radius: 999px; background: #b8b8be; transition: background .15s; }
.switch__track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .3); transition: transform .15s; }
.switch input:checked + .switch__track { background: var(--accent); }
.switch input:checked + .switch__track::after { transform: translateX(18px); }
.switch input:focus-visible + .switch__track { outline: 3px solid color-mix(in srgb, var(--blue) 50%, transparent); outline-offset: 2px; }
.switch b { display: block; font-size: 15px; }
.switch small { display: block; color: var(--text-2); font-size: 13px; }
.cat-row__colors { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px 28px; }
.swatches { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.swatches legend { font-weight: 600; font-size: 15px; padding: 0; margin-bottom: 6px; }
.swatch { position: relative; cursor: pointer; }
.swatch input { position: absolute; opacity: 0; width: 1px !important; height: 1px; }
.swatch span { display: block; width: 34px; height: 34px; border-radius: 50%; background: var(--sw); font-size: 0; border: 2px solid #000; box-sizing: border-box; }
@media (prefers-color-scheme: dark) { .swatch span { border-color: #fff; } }
.swatch--none span { background: repeating-linear-gradient(135deg, #fff 0 5px, #e5e5ea 5px 7px); }
.swatch input:checked + span { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--blue); }
.swatch input:focus-visible + span { outline: 3px solid color-mix(in srgb, var(--blue) 50%, transparent); outline-offset: 4px; }
.cat-row__view { margin-left: auto; font-size: 14px; color: var(--blue); }
.bib-modal { width: min(460px, calc(100% - 32px)); border: 0; border-radius: 18px; padding: 14px; background: var(--bg, #f2f2f7); }
.bib-modal::backdrop { background: rgba(0, 0, 0, .45); }
.bib-modal__bar { display: flex; justify-content: space-between; align-items: center; margin: 0 0 8px; }
.bib-modal iframe { width: 100%; height: 330px; border: 0; border-radius: 12px; background: #F3F5F7; display: block; }
.bib-modal p { margin: 8px 0 0; }
.cat-row__colors { position: relative; }
.cat-row__saved { position: absolute; right: 0; bottom: 6px; font-size: 13px; color: #2E7D32; font-weight: 600; }
.slot-time { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.slot-time input { flex: 1 1 0; min-width: 0; padding-left: 8px; padding-right: 8px; }

/* Classements */
.results-head { margin: 36px 0 0; align-items: center; }
.results-head .section-title { margin: 0; }
.results-row { flex-wrap: wrap; }
.results-row .list__main { flex: 1 1 280px; color: var(--text); }
.results-row__meta { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.results-row__meta form { margin: 0; }
.import-file__head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 4px 12px; }
.import-file__race, .import-map__grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 170px), 1fr)); gap: 12px; }
.import-map summary { min-height: 44px; display: flex; align-items: center; cursor: pointer; font-weight: 600; }
.import-map .hint { margin-top: 12px; }
.table-scroll { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table th, .data-table td { padding: 8px 10px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
.data-table th { font-weight: 600; color: var(--text-2); }
.data-table tr:last-child td { border-bottom: 0; }
.data-table form { margin: 0; }
.data-table .link-button { min-height: 32px; }
.paste-year { max-width: 140px; }
.results-more { flex-basis: 100%; }
.results-more summary { display: inline-flex; align-items: center; min-height: 44px; cursor: pointer; color: var(--blue); font-size: 14px; }
.results-more[open] { display: flex; flex-direction: column; gap: 10px; padding-bottom: 6px; }
.results-more__row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.results-more__row input { width: 110px; }
.results-row__meta { flex-wrap: wrap; justify-content: flex-end; }

/* Statistiques des courses (accueil) : une seule grille, toutes les barres partent et finissent au même endroit */
.stats-chart { gap: 14px; }
.stats-legend { margin: 0; display: flex; align-items: center; flex-wrap: wrap; gap: 6px 8px; font-size: 14px; color: var(--text-2); }
.stats-key { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.stats-legend .stats-key + .stats-key, .stats-legend .stats-key { margin-left: 4px; }
.stats-key--chrono, .stats-bar__chrono { background: #c1121f; }
.stats-key--walking, .stats-bar__walking { background: #0e7a9a; }
.stats-key--plaisir, .stats-bar__plaisir { background: #1d1d1f; }
@media (prefers-color-scheme: dark) { .stats-key--plaisir, .stats-bar__plaisir { background: #f5f5f7; } }
.stats-grid { display: grid; grid-template-columns: 44px minmax(0, 1fr) 52px auto auto; align-items: center; gap: 10px 12px; }
.stats-row { display: contents; }
.stats-bar__year { font-weight: 600; font-variant-numeric: tabular-nums; }
.stats-bar__track { display: flex; height: 18px; border-radius: 5px; background: var(--line); overflow: hidden; }
.stats-bar__track span { display: block; height: 100%; }
.stats-bar__value { text-align: right; font-variant-numeric: tabular-nums; }
.stats-bar__split { font-size: 13px; color: var(--text-2); white-space: nowrap; font-variant-numeric: tabular-nums; }
.stats-chrono { color: #c1121f; font-weight: 600; }
.stats-walking { color: #0e7a9a; font-weight: 600; }
.stats-plaisir { color: var(--text); font-weight: 600; }
.stats-bar__delta .delta { margin-left: 0; }
@media (max-width: 600px) { .stats-grid { grid-template-columns: 40px minmax(0, 1fr) 46px; } .stats-bar__split, .stats-bar__delta { grid-column: 2 / -1; margin-top: -6px; } }
.stats-table td { font-variant-numeric: tabular-nums; }
.stats-table th[scope="row"] { color: var(--text); font-weight: 500; }
.stats-table__total th, .stats-table__total td { font-weight: 700; }
.delta { font-size: 13px; font-weight: 600; margin-left: 6px; white-space: nowrap; }
.delta--up { color: var(--green); }
.delta--down { color: var(--accent); }
.stats-subtitle { font-size: 17px; margin: 28px 0 10px; }
.stats-multiples { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)); gap: 12px; }
.stats-mini { margin: 0; padding: 14px 16px 12px; background: var(--surface); border-radius: var(--radius); }
.stats-mini figcaption { font-weight: 600; font-size: 15px; margin-bottom: 10px; }
.stats-mini__bars { display: flex; align-items: flex-end; gap: 10px; }
.stats-mini__col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 0; }
.stats-mini__value { font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; }
.stats-mini__plot { display: flex; align-items: flex-end; justify-content: center; width: 100%; height: 110px; border-bottom: 1px solid var(--line); }
.stats-mini__bar { display: block; width: 100%; max-width: 46px; border-radius: 5px 5px 0 0; min-height: 2px; }
.stats-mini__year { font-size: 13px; color: var(--text-2); font-variant-numeric: tabular-nums; }

/* Statistiques : onglets (boutons radio, sans JavaScript) */
.stats-tabs__bar { display: flex; flex-wrap: wrap; gap: 6px; padding: 4px; margin-bottom: 12px; background: var(--line); border-radius: 12px; width: fit-content; max-width: 100%; }
.stats-tabs__bar label { min-height: 40px; display: inline-flex; align-items: center; padding: 0 14px; border-radius: 9px; font-size: 14px; font-weight: 600; color: var(--text-2); cursor: pointer; }
.stats-panel { display: none; }
#stats-tab-courbes:checked ~ .stats-panel--courbes, #stats-tab-distances:checked ~ .stats-panel--distances, #stats-tab-total:checked ~ .stats-panel--total, #stats-tab-courses:checked ~ .stats-panel--courses,
#stats-tab-comparer:checked ~ .stats-panel--comparer, #stats-tab-tableau:checked ~ .stats-panel--tableau { display: block; }
#stats-tab-courbes:checked ~ .stats-tabs__bar label[for="stats-tab-courbes"], #stats-tab-distances:checked ~ .stats-tabs__bar label[for="stats-tab-distances"], #stats-tab-total:checked ~ .stats-tabs__bar label[for="stats-tab-total"], #stats-tab-courses:checked ~ .stats-tabs__bar label[for="stats-tab-courses"],
#stats-tab-comparer:checked ~ .stats-tabs__bar label[for="stats-tab-comparer"], #stats-tab-tableau:checked ~ .stats-tabs__bar label[for="stats-tab-tableau"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }
.stats-tabs input:focus-visible ~ .stats-tabs__bar { outline: 3px solid color-mix(in srgb, var(--blue) 55%, transparent); outline-offset: 2px; }
.stats-tabs > .stats-legend { margin: 0 0 12px; }
.stats-compare { gap: 16px; }
.stats-compare__label { margin: 0 0 6px; font-weight: 600; }
.stats-compare__row { display: grid; grid-template-columns: 44px minmax(0, 1fr) 48px; align-items: center; gap: 10px; margin-bottom: 4px; }
.stats-compare__year { font-size: 13px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.stats-compare__track { height: 14px; border-radius: 4px; background: var(--line); overflow: hidden; }
.stats-compare__track span { display: block; height: 100%; border-radius: 4px; }
.stats-compare__value { text-align: right; font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; }

.stats-tabs { --plaisir-line: #1d1d1f; }
@media (prefers-color-scheme: dark) { .stats-tabs { --plaisir-line: #f5f5f7; } }
.stats-lines svg { display: block; width: 100%; height: auto; overflow: visible; }
.stats-lines__grid { stroke: var(--line); stroke-width: 1; }
.stats-lines__axis { font-size: 13px; fill: var(--text-2); font-variant-numeric: tabular-nums; }
.stats-lines__label { font-size: 13px; font-weight: 600; fill: var(--text); }
.stats-lines__total { font-size: 14px; font-weight: 700; fill: var(--text); font-variant-numeric: tabular-nums; }
.stats-lines__year { stroke: var(--surface); stroke-width: 1; opacity: .6; }
#stats-tab-distances:checked ~ .stats-legend { display: none; }

/* Accueil : quatre tuiles sur une ligne, bouton Aide-mémoire et sa fenêtre */
.tiles--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.tiles--4 .tile { padding: 16px; }
.tiles--4 .tile__value { font-size: 19px; line-height: 1.25; }
@media (max-width: 760px) { .tiles--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 420px) { .tiles--4 { grid-template-columns: 1fr; } }
.dash-help { margin: 12px 0 0; }
.dash-help .button { gap: 8px; min-height: 40px; padding: 6px 16px; font-size: 15px; }
.memo-modal { width: min(720px, calc(100% - 32px)); max-height: min(86vh, 900px); border: 0; border-radius: 18px; padding: 0; background: var(--surface); color: var(--text); box-shadow: 0 20px 60px rgba(0, 0, 0, .3); }
.memo-modal[open] { display: flex; flex-direction: column; }
.memo-modal::backdrop { background: rgba(0, 0, 0, .45); }
.memo-modal__bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 22px; border-bottom: 1px solid var(--line); }
.memo-modal__bar h2 { margin: 0; font-size: 20px; }
.memo-modal__bar form { margin: 0; }
.memo-modal__body { overflow-y: auto; padding: 4px 22px 18px; font-size: 15px; }
.memo-modal__intro { color: var(--text-2); }
.memo-modal__body h2 { font-size: 18px; margin: 22px 0 6px; color: var(--accent); }
.memo-modal__body h3 { font-size: 15px; margin: 14px 0 2px; }
.memo-modal__body p, .memo-modal__body ul { margin: 2px 0 8px; }
.memo-modal__body ul { padding-left: 20px; }
.memo-modal__foot { margin: 0; padding: 12px 22px; border-top: 1px solid var(--line); font-size: 14px; color: var(--text-2); }

/* Classements › une course : tableau complet, statut en pictogramme, poubelle pour retirer */
.results-table th, .results-table td { padding: 7px 8px; }
.results-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.results-table .center { text-align: center; }
.results-table td.wrap { white-space: normal; min-width: 110px; }
.results-table tr.is-muted td { color: var(--text-2); }
.status-icon { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 50%; vertical-align: middle; }
.status-icon--ok { color: var(--green); background: color-mix(in srgb, var(--green) 14%, transparent); }
.status-icon--dnf { color: var(--orange); background: color-mix(in srgb, var(--orange) 16%, transparent); }
.status-icon--dsq { color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, transparent); }
.status-icon--dns, .status-icon--listed { color: var(--text-2); background: var(--line); }
.status-legend { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 8px 0 10px; font-size: 14px; color: var(--text-2); }
.status-legend > span { display: inline-flex; align-items: center; gap: 6px; }
.icon-button { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border: 0; border-radius: 8px; background: none; color: var(--text-2); cursor: pointer; }
.icon-button:hover, .icon-button:focus-visible { background: var(--line); }
.icon-button--danger:hover, .icon-button--danger:focus-visible { color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); }
