/* ==========================================================================
   INTERFACE (accueil, connexion, régie)
   Thème sombre, une seule couleur d'accent. Tout est piloté par les
   variables ci-dessous : change --accent pour changer la couleur partout.
   ========================================================================== */

:root, :root[data-theme="dark"] {
  --bg: #09090b;
  --bg-glow: rgba(245, 194, 10, 0.06);
  --panel: #111113;
  --panel-2: #18181b;
  --panel-3: #202024;
  --line: rgba(255, 255, 255, 0.07);
  --line-strong: rgba(255, 255, 255, 0.14);
  --line-hover: rgba(255, 255, 255, 0.28);
  --hover: rgba(255, 255, 255, 0.03);
  --text: #fafafa;
  --text-2: var(--text-2);
  --muted: #a1a1aa;
  /* Contraste ≥ 4,5:1 sur tous les fonds de l'interface (WCAG AA) */
  --faint: #8e8e98;
  --accent: #f5c20a;
  --accent-ink: #0b0d02;
  --accent-soft: rgba(245, 194, 10, 0.14);
  --accent-line: rgba(245, 194, 10, 0.4);
  --accent-text: var(--accent-text-dark, #f5c20a);
  --ok: #3ddc84;
  --warn: #ffb547;
  --danger: #ff5f5f;
  --danger-soft: rgba(255, 95, 95, 0.12);
  --ok-soft: rgba(61, 220, 132, 0.18);
  --warn-soft: rgba(255, 181, 71, 0.12);
  --glass: rgba(9, 9, 11, 0.78);
  --sidebar-bg: rgba(13, 13, 16, 0.6);
  --aside-bg: var(--aside-bg);
  --scroll: var(--scroll);
  --shadow: 0 1px 0 rgba(255,255,255,0.03) inset, 0 20px 40px -24px rgba(0,0,0,0.8);
  --shadow-pop: var(--shadow-pop);
  --overlay: rgba(0, 0, 0, 0.7);
  --select-arrow: var(--select-arrow);
  --radius: 18px;
  --radius-md: 12px;
  --radius-sm: 9px;
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
}

/* Thème clair : mêmes composants, couleurs inversées (contrastes ≥ 4,5:1). */
:root[data-theme="light"] {
  --bg: #f4f4f5;
  --bg-glow: rgba(135, 107, 6, 0.05);
  --panel: #ffffff;
  --panel-2: #f8f8f9;
  --panel-3: #eeeef0;
  --line: rgba(9, 9, 11, 0.08);
  --line-strong: rgba(9, 9, 11, 0.16);
  --line-hover: rgba(9, 9, 11, 0.32);
  --hover: rgba(9, 9, 11, 0.03);
  --text: #18181b;
  --text-2: #3f3f46;
  --muted: #52525b;
  --faint: #636370;
  --accent-text: var(--accent-text-light, #7a6105);
  --ok: #0f7a3d;
  --warn: #9a5b00;
  --danger: #c62828;
  --danger-soft: rgba(198, 40, 40, 0.08);
  --ok-soft: rgba(15, 122, 61, 0.12);
  --warn-soft: rgba(154, 91, 0, 0.1);
  --glass: rgba(255, 255, 255, 0.82);
  --sidebar-bg: rgba(255, 255, 255, 0.7);
  --aside-bg: linear-gradient(180deg, #ffffff, #f1f1f3);
  --scroll: #c4c4cc;
  --shadow: 0 1px 2px rgba(9,9,11,0.04), 0 12px 32px -20px rgba(9,9,11,0.25);
  --shadow-pop: 0 16px 40px -16px rgba(9,9,11,0.3);
  --overlay: rgba(9, 9, 11, 0.45);
  --select-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2352525b' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body.ui {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 85% -10%, var(--bg-glow), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
a { color: inherit; }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.icon { width: 18px; height: 18px; flex: 0 0 auto; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Boutons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px; border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong); background: var(--panel-2); color: var(--text);
  font: 600 13px/1 var(--font); letter-spacing: 0.1px; cursor: pointer; text-decoration: none;
  transition: background .15s, border-color .15s, color .15s, transform .08s, box-shadow .15s;
  white-space: nowrap; user-select: none;
}
.btn:hover { border-color: var(--line-hover); background: var(--panel-3); }
.btn:active { transform: scale(0.97); }
.btn:focus-visible, .input:focus-visible, .select:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn-accent { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-accent:hover { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); filter: brightness(1.08); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--panel-2); color: var(--text); border-color: var(--line); }
.btn-outline { background: transparent; }
.btn-danger { background: transparent; color: var(--danger); border-color: rgba(255,95,95,0.35); }
.btn-danger:hover { background: var(--danger-soft); border-color: var(--danger); }
.btn-sm { height: 32px; padding: 0 12px; font-size: 12px; }
.btn-block { width: 100%; }
.btn-icon { width: 32px; height: 32px; padding: 0; border-radius: 8px; }
.btn.is-live { border-color: var(--accent); color: var(--accent-text); background: var(--accent-soft); }
.btn.is-live::after {
  content: "À L'ÉCRAN"; font-size: 9px; letter-spacing: 1px; font-weight: 800;
  padding: 3px 6px; border-radius: 5px; background: var(--accent); color: var(--accent-ink);
}

/* ---------- Champs ---------- */
.input, .select {
  width: 100%; height: 40px; padding: 0 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong); background: var(--bg); color: var(--text);
  font: 500 14px var(--font); transition: border-color .15s, box-shadow .15s;
}
.input::placeholder { color: var(--faint); }
.input:focus, .select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.select { appearance: none; padding-right: 34px; cursor: pointer;
  background-image: var(--select-arrow);
  background-repeat: no-repeat; background-position: right 12px center; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field + .field { margin-top: 12px; }
.label { font-size: 12px; font-weight: 600; color: var(--muted); }
.row { display: flex; gap: 8px; align-items: center; }
.row > .input, .row > .select { flex: 1; min-width: 0; }

/* ---------- Pastilles ---------- */
.pill {
  display: inline-flex; align-items: center; gap: 7px; height: 28px; padding: 0 11px;
  border-radius: 999px; border: 1px solid var(--line-strong); background: var(--panel);
  font-size: 12px; font-weight: 600; color: var(--muted); white-space: nowrap;
}
.pill .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); }
.pill.ok .dot { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.pill.ko { color: var(--danger); border-color: rgba(255,95,95,0.4); }
.pill.ko .dot { background: var(--danger); animation: blink 1s infinite; }
.pill.accent { color: var(--accent-text); border-color: var(--accent-line); background: var(--accent-soft); }
@keyframes blink { 50% { opacity: 0.3; } }

/* ==========================================================================
   CARTES DE VERSION (tableau de bord)
   ========================================================================== */
.choice-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 18px; }
.choice {
  position: relative; display: flex; flex-direction: column; gap: 18px;
  padding: 28px; border-radius: 22px; border: 1px solid var(--line-strong);
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  box-shadow: var(--shadow); transition: border-color .2s, transform .2s;
}
.choice:hover { border-color: var(--accent-line); transform: translateY(-2px); }
.choice-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.choice-icon { width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center; background: var(--panel-3); border: 1px solid var(--line-strong); color: var(--accent-text); }
.choice-icon .icon { width: 22px; height: 22px; }
.choice h2 { font-size: 22px; margin: 0 0 6px; letter-spacing: -0.4px; }
.choice p { margin: 0; color: var(--muted); }
.choice ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 9px; }
.choice li { display: flex; gap: 10px; align-items: flex-start; color: var(--text-2); font-size: 13.5px; }
.choice li .icon { width: 16px; height: 16px; margin-top: 2px; color: var(--accent-text); stroke-width: 2.6; }
.choice-actions { display: flex; gap: 10px; margin-top: auto; padding-top: 6px; }
.choice-actions .btn { flex: 1; height: 44px; }
@media (max-width: 760px) {
  .choice-grid { grid-template-columns: 1fr; }
  .choice { padding: 22px; }
}

/* ==========================================================================
   RÉGIE
   ========================================================================== */
.appbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 12px 24px; border-bottom: 1px solid var(--line);
  background: var(--glass); backdrop-filter: saturate(160%) blur(14px); -webkit-backdrop-filter: saturate(160%) blur(14px);
}
.appbar-left, .appbar-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.appbar .brand-mark { width: 34px; height: 34px; border-radius: 10px; }
.appbar .brand-mark .icon { width: 19px; height: 19px; }

.admin-main {
  max-width: 1560px; margin: 0 auto; padding: 22px 24px 48px;
  display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 20px; align-items: start;
}
.col { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
@media (max-width: 1100px) {
  .admin-main { grid-template-columns: 1fr; padding: 16px; }
  .appbar { padding: 10px 16px; }
}
@media (max-width: 640px) {
  .appbar .hide-sm { display: none; }
}

.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 20px; min-width: 0;
}
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.card-title { display: flex; align-items: center; gap: 10px; font-size: 15px; font-weight: 700; letter-spacing: -0.2px; margin: 0; }
.card-sub { color: var(--muted); font-size: 12.5px; margin-top: 3px; }
.step-num {
  width: 24px; height: 24px; border-radius: 7px; display: grid; place-items: center;
  font-size: 12px; font-weight: 800; background: var(--panel-3); color: var(--muted); border: 1px solid var(--line-strong);
}
.count-badge { min-width: 22px; height: 22px; padding: 0 7px; border-radius: 999px; display: inline-grid; place-items: center; font-size: 12px; font-weight: 700; background: var(--panel-3); color: var(--muted); }
.count-badge.hot { background: var(--accent); color: var(--accent-ink); }
.divider { height: 1px; background: var(--line); margin: 18px 0; }

/* ---------- Buzzer ---------- */
.buzz-card { display: grid; grid-template-columns: minmax(0, 1fr) minmax(260px, 340px); gap: 20px; padding: 22px; }
.buzz-info { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.live-list { display: flex; flex-direction: column; gap: 8px; }
.live-item {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 14px; border-radius: var(--radius-md); background: var(--panel-2); border: 1px solid var(--line);
}
.live-item .name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.live-item .clock { font-family: var(--font-mono); font-size: 22px; font-weight: 700; letter-spacing: -0.5px; color: var(--accent-text); font-variant-numeric: tabular-nums; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 0 var(--accent-soft); animation: ping 1.6s infinite; flex: 0 0 auto; }
@keyframes ping { 0% { box-shadow: 0 0 0 0 var(--accent-line); } 100% { box-shadow: 0 0 0 9px transparent; } }
.live-empty { padding: 18px; border-radius: var(--radius-md); border: 1px dashed var(--line-strong); color: var(--muted); text-align: center; }

.buzzer-btn {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  width: 100%; min-height: 220px; border: none; border-radius: 22px; cursor: pointer;
  background: radial-gradient(120% 120% at 30% 20%, color-mix(in srgb, var(--accent), white 45%) 0%, var(--accent) 45%, color-mix(in srgb, var(--accent), black 22%) 100%);
  color: var(--accent-ink); font: 900 38px/1 var(--font); letter-spacing: 4px;
  box-shadow: 0 0 0 1px var(--accent-line), 0 24px 60px -20px var(--accent-line), inset 0 -6px 0 rgba(0,0,0,0.12);
  transition: transform .08s, box-shadow .2s, filter .2s;
}
.buzzer-btn:hover { filter: brightness(1.04); }
.buzzer-btn:active, .buzzer-btn.pressed { transform: scale(0.965); box-shadow: 0 0 0 1px var(--accent-line), 0 10px 30px -14px var(--accent-line), inset 0 -2px 0 rgba(0,0,0,0.12); }
.buzzer-btn .icon { width: 34px; height: 34px; stroke-width: 2.6; }
.buzzer-btn small { font-size: 11px; font-weight: 700; letter-spacing: 1.5px; opacity: 0.6; }
.buzzer-btn:disabled { filter: grayscale(1) brightness(0.45); cursor: not-allowed; box-shadow: none; }
.kbd { display: inline-block; padding: 2px 7px; border-radius: 6px; border: 1px solid var(--line-strong); border-bottom-width: 2px; font-family: var(--font-mono); font-size: 11px; color: var(--muted); }
.buzz-hint { font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.outbox-warn { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--warn-soft); color: var(--warn); font-size: 13px; font-weight: 600; }
@media (max-width: 760px) {
  .buzz-card { grid-template-columns: 1fr; }
  .buzzer-btn { min-height: 160px; order: -1; }
}

/* ---------- File d'arrivées ---------- */
.queue-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.queue-card {
  display: flex; flex-direction: column; gap: 10px; padding: 14px;
  border-radius: var(--radius-md); background: var(--panel-2); border: 1px solid var(--line-strong);
  animation: pop .22s ease-out;
}
.queue-card.manual { border-style: dashed; }
@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(0.98); } to { opacity: 1; transform: none; } }
.queue-meta { display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: var(--muted); }
.queue-meta b { color: var(--text); font-family: var(--font-mono); font-weight: 600; }
.queue-inputs { display: flex; gap: 8px; }
.queue-inputs .input { flex: 1; min-width: 0; font-size: 16px; font-weight: 600; }
.queue-preview { min-height: 54px; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--bg); border: 1px solid var(--line); display: flex; flex-direction: column; justify-content: center; }
.queue-preview .hint { font-size: 12.5px; color: var(--faint); }
.queue-preview .grp { font-size: 11px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: 0.6px; }
.queue-preview .tm { font-family: var(--font-mono); font-size: 20px; font-weight: 700; color: var(--accent-text); font-variant-numeric: tabular-nums; }
.queue-preview .nm { font-size: 13px; color: var(--text); font-weight: 600; }
.queue-newgroup { display: flex; flex-direction: column; gap: 8px; }
.queue-btns { display: flex; gap: 8px; }
.queue-btns .btn { flex: 1; }
.empty {
  display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 28px 16px; text-align: center;
  border-radius: var(--radius-md); border: 1px dashed var(--line-strong); color: var(--faint); font-size: 13px;
}
.empty .icon { width: 22px; height: 22px; color: var(--faint); }

/* ---------- Import CSV ---------- */
.dropzone {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  padding: 22px 16px; border-radius: var(--radius-md); border: 1.5px dashed var(--line-strong);
  background: var(--bg); color: var(--muted); text-align: center; cursor: pointer; transition: border-color .15s, background .15s;
}
.dropzone:hover, .dropzone.drag { border-color: var(--accent); background: var(--accent-soft); color: var(--text); }
.dropzone .icon { width: 24px; height: 24px; color: var(--accent-text); }
.dropzone strong { color: var(--text); font-size: 13.5px; }
.dropzone small { font-size: 12px; }
.dropzone input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.csv-help { font-size: 12px; color: var(--faint); margin-top: 10px; }
.csv-help code { font-family: var(--font-mono); color: var(--muted); background: var(--panel-2); padding: 1px 5px; border-radius: 5px; }
.feedback { font-size: 13px; margin-top: 10px; color: var(--ok); }
.feedback.err { color: var(--danger); }

/* ---------- Groupes ---------- */
.wave-list { display: flex; flex-direction: column; gap: 8px; }
.wave-row {
  display: flex; align-items: center; gap: 10px; padding: 10px 10px 10px 12px;
  border-radius: var(--radius-md); background: var(--panel-2); border: 1px solid var(--line);
}
.wave-row.running { border-color: var(--accent-line); }
.wave-status { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); flex: 0 0 auto; }
.wave-row.running .wave-status { background: var(--accent); animation: ping 1.6s infinite; }
.wave-row.stopped .wave-status { background: var(--muted); }
.wave-info { flex: 1; min-width: 0; }
.wave-info .n { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wave-info .m { font-size: 12px; color: var(--muted); }
.wave-clock { font-family: var(--font-mono); font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--accent-text); }
.wave-row.stopped .wave-clock { color: var(--muted); }
.wave-del { color: var(--faint); }
.wave-del:hover { color: var(--danger); }

/* ---------- Affichage TV ---------- */
.tv-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tv-grid .btn { height: 44px; }
.tv-grid .btn.span-2 { grid-column: span 2; }
.tv-section + .tv-section { margin-top: 16px; }
.tv-section .label { display: block; margin-bottom: 8px; }
.tv-section .select { margin-bottom: 8px; }

/* ---------- Tableau participants ---------- */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.stat { padding: 12px 14px; border-radius: var(--radius-md); background: var(--panel-2); border: 1px solid var(--line); }
.stat .v { font-size: 24px; font-weight: 800; letter-spacing: -0.5px; font-variant-numeric: tabular-nums; }
.stat .l { font-size: 12px; color: var(--muted); }
.stat.hot .v { color: var(--accent-text); }
.table-tools { display: flex; gap: 8px; margin-bottom: 12px; }
.table-tools .input { flex: 1; }
.search { position: relative; flex: 1; }
.search .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--faint); }
.search .input { padding-left: 36px; }
.table-wrap { position: relative; max-height: 460px; overflow: auto; border-radius: var(--radius-md); border: 1px solid var(--line); scrollbar-width: thin; scrollbar-color: var(--scroll) transparent; }
.table-wrap table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table-wrap th, .table-wrap td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table-wrap td.name { white-space: normal; font-weight: 600; }
.table-wrap thead th { position: sticky; top: 0; z-index: 1; background: var(--panel-2); color: var(--faint); font-size: 11px; text-transform: uppercase; letter-spacing: 0.7px; font-weight: 700; }
.table-wrap tbody tr:hover { background: var(--hover); }
.table-wrap tbody tr:last-child td { border-bottom: none; }
.rank { display: inline-grid; place-items: center; min-width: 26px; height: 22px; padding: 0 6px; border-radius: 6px; font-weight: 800; font-size: 12px; background: var(--panel-3); color: var(--muted); }
.rank.r1 { background: var(--accent); color: var(--accent-ink); }
.rank.r2, .rank.r3 { background: var(--accent-soft); color: var(--accent-text); }
.tag { display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: 11.5px; background: var(--panel-3); color: var(--muted); }
.status-run { color: var(--faint); font-style: italic; }
.table-empty { padding: 24px; text-align: center; color: var(--faint); }

/* ---------- Toasts ---------- */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 100; display: flex; flex-direction: column; gap: 8px; max-width: min(420px, calc(100vw - 40px)); }
.toast {
  display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius-md);
  background: var(--panel-3); border: 1px solid var(--line-strong); box-shadow: var(--shadow-pop);
  font-size: 13.5px; animation: pop .2s ease-out;
}
.toast .icon { width: 18px; height: 18px; margin-top: 1px; }
.toast.ok .icon { color: var(--ok); }
.toast.err { border-color: rgba(255,95,95,0.45); }
.toast.err .icon { color: var(--danger); }
.toast.hide { opacity: 0; transform: translateY(6px); transition: opacity .2s, transform .2s; }

/* Éléments propres à une seule version */
body.mode-complet [data-only]:not([data-only~="complet"]),
body.mode-simple [data-only]:not([data-only~="simple"]),
body.mode-officiel [data-only]:not([data-only~="officiel"]),
body.mode-saisie [data-only]:not([data-only~="saisie"]),
body.mode-solo [data-only]:not([data-only~="solo"]),
body.mode-entrainement [data-only]:not([data-only~="entrainement"]) { display: none !important; }

/* Ajustements petits écrans */
.tv-grid .btn { min-width: 0; }
.wave-info .m { white-space: nowrap; }
@media (max-width: 480px) {
  .tv-grid { grid-template-columns: 1fr; }
  .tv-grid .btn.span-2 { grid-column: auto; }
}

/* ==========================================================================
   ÉLÉMENTS COMMUNS
   ========================================================================== */
.brand { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; color: inherit; min-width: 0; }
.brand-mark {
  width: 40px; height: 40px; border-radius: 11px; background: var(--accent); color: var(--accent-ink);
  display: grid; place-items: center; flex: 0 0 auto; overflow: hidden;
  box-shadow: 0 8px 24px -8px var(--accent-line);
}
.brand-mark .icon { width: 22px; height: 22px; stroke-width: 2.4; }
/* Logo importé : il remplit toute la zone du logo (recadré au centre si
   ses proportions diffèrent), sans fond ni marge. */
.brand-mark.has-logo { background: transparent; box-shadow: none; }
.brand-mark.has-logo img { display: block; width: 100%; height: 100%; padding: 0; object-fit: cover; }
.brand-mark img { width: 100%; height: 100%; object-fit: contain; padding: 4px; }
.brand-name { font-weight: 800; font-size: 17px; letter-spacing: -0.2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.hint { font-weight: 500; color: var(--faint); margin-left: 4px; }
.eyebrow { font-size: 12px; font-weight: 700; letter-spacing: 1.2px; text-transform: uppercase; color: var(--accent-text); margin-bottom: 6px; }
.btn-lg { height: 46px; font-size: 14px; }
.select-sm { height: 32px; font-size: 12.5px; padding-right: 30px; width: auto; }
.form-error { color: var(--danger); font-size: 13px; min-height: 18px; margin-top: 10px; }
.form-actions { display: flex; justify-content: flex-end; margin-top: 16px; }
.danger-text { color: var(--danger) !important; }
.pill.ok-pill { color: var(--ok); border-color: rgba(61,220,132,0.35); }
.pill.ko-pill { color: var(--danger); border-color: rgba(255,95,95,0.4); }
body.is-tv #adminView { display: none; }

/* ==========================================================================
   CONNEXION / INSCRIPTION
   ========================================================================== */
.auth-layout { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); }
.auth-aside {
  position: relative; display: flex; flex-direction: column; justify-content: space-between; gap: 40px;
  padding: 44px 52px; border-right: 1px solid var(--line); overflow: hidden;
  background:
    radial-gradient(600px 400px at 20% 110%, var(--accent-soft), transparent 70%),
    var(--aside-bg);
}
.auth-aside::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: 0.35;
  background-image: linear-gradient(var(--line) 1px, transparent 1px), linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 48px 48px; mask-image: radial-gradient(ellipse at 30% 60%, #000 10%, transparent 70%);
}
.auth-pitch { position: relative; z-index: 1; max-width: 520px; }
.auth-pitch h1 { font-size: clamp(32px, 4vw, 48px); line-height: 1.05; letter-spacing: -1.4px; margin: 0 0 28px; }
.auth-pitch h1 em { font-style: normal; color: var(--accent-text); }
.auth-pitch ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; }
.auth-pitch li { display: flex; align-items: center; gap: 12px; color: var(--text-2); font-size: 15px; }
.auth-pitch li .icon { width: 34px; height: 34px; padding: 8px; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--line-strong); color: var(--accent-text); }
.auth-foot { position: relative; z-index: 1; color: var(--faint); font-size: 12.5px; letter-spacing: 0.5px; }
.auth-main { display: grid; place-items: center; padding: 32px 24px; }
.auth-card { width: 100%; max-width: 400px; }
.auth-card h2 { font-size: 26px; letter-spacing: -0.6px; margin: 0 0 6px; }
.auth-card > form > p.muted { margin: 0 0 26px; }
.auth-card .field + .field { margin-top: 14px; }
.auth-card .btn-lg { width: 100%; margin-top: 20px; }
.auth-switch { text-align: center; color: var(--muted); font-size: 13.5px; margin-top: 18px; }
.auth-switch a { color: var(--accent-text); text-decoration: none; font-weight: 600; }
.auth-mobile-brand { display: none; margin-bottom: 28px; }
.first-badge { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-text); font-size: 12.5px; font-weight: 700; margin-bottom: 16px; }
.first-badge .icon { width: 15px; height: 15px; }
@media (max-width: 900px) {
  .auth-layout { grid-template-columns: 1fr; }
  .auth-aside { display: none; }
  .auth-mobile-brand { display: inline-flex; }
}

/* ==========================================================================
   ESPACE CLIENT
   ========================================================================== */
.shell { display: grid; grid-template-columns: 260px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 28px;
  padding: 22px 16px; border-right: 1px solid var(--line); background: var(--sidebar-bg);
}
.sidebar > .brand { padding: 0 8px; }
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav a {
  display: flex; align-items: center; gap: 12px; height: 42px; padding: 0 12px; border-radius: 10px;
  color: var(--muted); text-decoration: none; font-weight: 600; transition: background .15s, color .15s;
}
.nav a:hover { background: var(--panel-2); color: var(--text); }
.nav a.active { background: var(--accent-soft); color: var(--accent-text); }
.sidebar-foot { margin-top: auto; display: flex; align-items: center; gap: 8px; padding: 12px 8px 0; border-top: 1px solid var(--line); }
.me { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; flex: 0 0 auto; background: var(--panel-3); border: 1px solid var(--line-strong); font-weight: 800; color: var(--accent-text); }
.me-text { min-width: 0; }
.me-name { font-weight: 700; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-mail { font-size: 11.5px; color: var(--faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.content { padding: 36px 40px 64px; max-width: 1400px; width: 100%; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 26px; flex-wrap: wrap; }
.page-head h1 { font-size: 30px; letter-spacing: -0.8px; margin: 0 0 6px; }
.page-head p { margin: 0; max-width: 640px; }
.stack { display: flex; flex-direction: column; gap: 20px; max-width: 860px; }
.card .card-title { margin-bottom: 16px; }

.tv-link-box .label { display: block; margin-bottom: 6px; }
.copy-row { display: flex; gap: 8px; }
.copy-row .input { flex: 1; min-width: 0; font-size: 12.5px; color: var(--muted); }
.copy-row .btn-icon { width: 40px; height: 40px; }

.promo {
  display: flex; align-items: center; gap: 16px; margin-top: 18px; padding: 18px 20px; border-radius: var(--radius);
  border: 1px dashed var(--line-strong); text-decoration: none; color: inherit; transition: border-color .15s, background .15s;
}
.promo:hover { border-color: var(--accent-line); background: var(--accent-soft); }
.promo-icon { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: var(--accent); color: var(--accent-ink); flex: 0 0 auto; }
.promo .chevron { margin-left: auto; color: var(--faint); }

@media (max-width: 960px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: sticky; top: 0; z-index: 30; height: auto; flex-direction: row; align-items: center; gap: 10px; padding: 10px 12px; backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); background: var(--glass); border-right: none; border-bottom: 1px solid var(--line); }
  .sidebar > .brand .brand-name, .me-text { display: none; }
  .sidebar > .brand { padding: 0; }
  .brand-mark { width: 34px; height: 34px; }
  .nav { flex-direction: row; gap: 2px; overflow-x: auto; flex: 1; }
  .nav a { height: 36px; padding: 0 10px; white-space: nowrap; font-size: 13px; }
  .sidebar-foot { margin: 0; padding: 0; border: none; }
  .content { padding: 22px 16px 48px; }
}
@media (max-width: 960px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { min-width: 0; max-width: 100vw; }
  .nav { min-width: 0; }
}
/* Téléphone : menu « hamburger ». Le panneau occupe tout l'écran sous la
   barre du haut et défile seul. (Pas de flou sur la barre quand il est
   ouvert : un « backdrop-filter » enfermerait le panneau dans la barre.) */
.nav-toggle { display: none; }
@media (max-width: 760px) {
  .nav-toggle { display: inline-flex; order: -1; }
  .sidebar { gap: 6px; padding: 8px 12px; min-height: 56px; }
  .sidebar > .brand { margin-right: auto; }
  .sidebar > .brand .brand-name { display: block; font-size: 15px; max-width: 46vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .sidebar .nav { display: none; }
  /* Menu ouvert : la barre du haut est fixée (elle ne part plus avec la
     page quand on a défilé jusqu'en bas) ; la place qu'elle occupait est
     gardée pour que la page ne saute pas. */
  body.nav-open .sidebar { position: fixed; top: 0; left: 0; right: 0; height: 56px; backdrop-filter: none; -webkit-backdrop-filter: none; background: var(--bg); }
  body.nav-open .shell { padding-top: 56px; }
  body.nav-open .sidebar .nav {
    display: flex; flex-direction: column; flex-wrap: nowrap; gap: 2px;
    position: fixed; top: 56px; left: 0; right: 0; height: calc(100vh - 56px); height: calc(100dvh - 56px); z-index: 40;
    overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
    padding: 12px 12px calc(32px + env(safe-area-inset-bottom)); background: var(--bg); border-top: 1px solid var(--line);
  }
  body.nav-open .nav a { flex: 0 0 auto; height: 48px; font-size: 15px; padding: 0 14px; }
  body.nav-open .nav a span { display: inline; }
  body.nav-open .nav-group:not([hidden]) { display: flex; flex-direction: column; gap: 2px; flex: 0 0 auto; }
  body.nav-open .nav-label { display: block; }
  html:has(body.nav-open), body.nav-open { overflow: hidden; }
}

/* ---------- Personnalisation ---------- */
.brand-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(340px, 520px); gap: 24px; align-items: start; }
.brand-form { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px 16px; }
.grid-2 .field + .field, .grid-3 .field + .field { margin-top: 0; }
.span-2 { grid-column: span 2; }
.color-row { display: flex; gap: 8px; }
.color-row input[type="color"] { width: 46px; height: 40px; padding: 3px; border-radius: var(--radius-sm); border: 1px solid var(--line-strong); background: var(--bg); cursor: pointer; flex: 0 0 auto; }
.color-row .input { flex: 1; min-width: 0; }
.switch { display: flex; align-items: flex-start; gap: 12px; margin-top: 16px; cursor: pointer; line-height: 1.4; }
.switch { position: relative; }
.switch input { position: absolute; left: 0; top: 0; width: 42px; height: 24px; margin: 0; opacity: 0; z-index: 1; cursor: pointer; }
.switch-ui { position: relative; width: 40px; height: 22px; border-radius: 999px; background: var(--panel-3); border: 1px solid var(--line-strong); flex: 0 0 auto; transition: background .15s; margin-top: 1px; }
.switch-ui::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--muted); transition: transform .15s, background .15s; }
.switch input:checked + .switch-ui { background: var(--accent); border-color: var(--accent); }
.switch input:checked + .switch-ui::after { transform: translateX(18px); background: var(--accent-ink); }
.switch input:focus-visible + .switch-ui { outline: 2px solid var(--accent); outline-offset: 2px; }

.upload-grid { display: grid; gap: 10px; margin-top: 16px; }
.upload { display: flex; align-items: center; gap: 14px; padding: 12px; border-radius: var(--radius-md); background: var(--panel-2); border: 1px solid var(--line); }
.upload.is-custom { border-color: var(--accent-line); }
.upload.busy { opacity: 0.6; pointer-events: none; }
.upload-thumb {
  width: 56px; height: 56px; border-radius: 10px; flex: 0 0 auto; border: 1px solid var(--line-strong);
  background: #000 center / contain no-repeat;
  background-image: none;
}
.upload-thumb img { width: 100%; height: 100%; object-fit: contain; border-radius: inherit; }
#regieLogoThumb img { object-fit: cover; } /* aperçu identique au logo affiché : toute la zone */
.upload-thumb.wide { width: 96px; height: 54px; background-size: cover; }
.upload-thumb.empty { background-image: repeating-linear-gradient(45deg, var(--panel-3) 0 6px, var(--panel-2) 6px 12px) !important; }
.upload-thumb.font-thumb { display: grid; place-items: center; font-size: 24px; font-weight: 800; background: var(--bg); }
.upload-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.upload-text small { color: var(--faint); font-size: 12px; }
.upload-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }

.savebar {
  position: sticky; bottom: 16px; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 12px 14px 12px 18px; border-radius: var(--radius); border: 1px solid var(--line-strong);
  background: var(--glass); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  box-shadow: var(--shadow-pop);
}
.savebar.dirty { border-color: var(--accent-line); }
.savebar.dirty #saveStatus { color: var(--accent-text); }

.preview { position: sticky; top: 24px; display: flex; flex-direction: column; gap: 10px; }
.preview-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.preview-frame { position: relative; width: 100%; border-radius: var(--radius-md); overflow: hidden; border: 1px solid var(--line-strong); background: #000; box-shadow: 0 30px 60px -30px rgba(0,0,0,0.9); }
.preview-frame iframe { position: absolute; top: 0; left: 0; width: 1920px; height: 1080px; border: 0; transform-origin: 0 0; pointer-events: none; }

@media (max-width: 1180px) {
  .brand-layout { grid-template-columns: 1fr; }
  .preview { position: static; order: -1; }
}
@media (max-width: 640px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .upload { flex-wrap: wrap; }
}

/* ---------- Administration ---------- */
.row-actions { display: flex; gap: 4px; justify-content: flex-end; }
.row-actions .btn { height: 30px; padding: 0 8px; font-size: 12px; }
.table-wrap td .muted.small { font-weight: 400; }

/* ---------- Fenêtre ---------- */
.modal {
  width: min(460px, calc(100vw - 32px)); padding: 24px; border-radius: 20px;
  border: 1px solid var(--line-strong); background: var(--panel); color: var(--text);
  box-shadow: var(--shadow-pop);
}
.modal::backdrop { background: var(--overlay); backdrop-filter: blur(4px); }
.modal h2 { font-size: 19px; margin: 0 0 18px; letter-spacing: -0.3px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }


/* ==========================================================================
   ACCESSIBILITÉ
   ========================================================================== */
.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: 12px; top: -60px; z-index: 200; padding: 10px 16px; border-radius: var(--radius-sm);
  background: var(--accent); color: var(--accent-ink); font-weight: 700; text-decoration: none; transition: top .15s;
}
.skip-link:focus { top: 12px; }
a:focus-visible, button:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.file-btn:focus-within, .dropzone:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.check { display: flex; align-items: flex-start; gap: 10px; margin-top: 16px; font-size: 13.5px; line-height: 1.45; color: var(--text); cursor: pointer; }
.check input { width: 18px; height: 18px; margin: 1px 0 0; flex: 0 0 auto; accent-color: var(--accent); cursor: pointer; }
.check a, .privacy-note a, .legal a, .legal-footer a, .muted a { color: var(--accent-text); }
.privacy-note { margin-top: 18px; font-size: 12.5px; color: var(--muted); line-height: 1.5; }
.link-btn { background: none; border: none; padding: 0; color: var(--muted); font: inherit; text-decoration: underline; cursor: pointer; }
.link-btn:hover { color: var(--text); }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

/* ==========================================================================
   PAGES LÉGALES ET PIED DE PAGE
   ========================================================================== */
.legal-footer { padding: 24px 16px 32px; text-align: center; }
.legal-footer ul, .sidebar-legal ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 18px; }
.legal-footer a, .sidebar-legal a { color: var(--muted); font-size: 12.5px; text-decoration: none; }
.legal-footer a:hover, .sidebar-legal a:hover, .legal-footer a[aria-current="page"] { color: var(--text); text-decoration: underline; }
.sidebar-legal { padding: 4px 8px 0; }
.sidebar-legal ul { justify-content: flex-start; gap: 4px 12px; }
.sidebar-legal a { font-size: 11.5px; }
.auth-layout:has(+ .legal-footer) { min-height: calc(100vh - 76px); }
@media (max-width: 960px) { .sidebar-legal { display: none; } }

.legal-page { min-height: 100vh; }
.legal-header { max-width: 860px; margin: 0 auto; padding: 24px 24px 0; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.legal { max-width: 860px; margin: 0 auto; padding: 32px 24px 24px; line-height: 1.65; font-size: 15px; }
.legal h1 { font-size: clamp(28px, 4vw, 38px); letter-spacing: -1px; margin: 0 0 8px; line-height: 1.15; }
.legal h2 { font-size: 19px; letter-spacing: -0.3px; margin: 36px 0 10px; }
.legal p, .legal li { color: var(--text-2); }
.legal ul { padding-left: 20px; }
.legal li + li { margin-top: 6px; }
.legal-meta { color: var(--muted) !important; font-size: 13.5px; }
.legal-dl { display: grid; grid-template-columns: minmax(160px, 240px) 1fr; gap: 8px 20px; margin: 0; }
.legal-dl > div { display: contents; }
.legal-dl dt { color: var(--muted); font-size: 14px; }
.legal-dl dd { margin: 0; }
.legal-dl [hidden] { display: none; }
.legal-table { margin: 12px 0; max-height: none; }
.legal-table td { white-space: normal; vertical-align: top; font-size: 13.5px; line-height: 1.5; }
.legal-box { margin: 16px 0; padding: 16px 20px; border-radius: var(--radius-md); border: 1px solid var(--line-strong); background: var(--panel); }
mark.todo { background: rgba(255,181,71,0.16); color: var(--warn); padding: 1px 6px; border-radius: 5px; font-size: 0.92em; }
@media (max-width: 640px) {
  .legal-dl { grid-template-columns: 1fr; gap: 2px; }
  .legal-dl dd { margin-bottom: 10px; }
}

/* Acceptation des CGU */
.auth-title { font-size: 26px; letter-spacing: -0.6px; margin: 28px 0 6px; }
.terms-form .muted { margin: 0 0 16px; }
.terms-links { padding-left: 20px; margin: 0 0 4px; line-height: 1.8; }
.terms-links a { color: var(--accent-text); }

/* Espace client */
.fieldset { border: 1px solid var(--line); border-radius: var(--radius-md); padding: 14px 16px 16px; margin: 16px 0 0; min-width: 0; }
.fieldset legend { padding: 0 6px; font-weight: 700; font-size: 13px; color: var(--muted); }
.warn-box { border-color: rgba(255,181,71,0.45); border-style: solid; margin: 0 0 18px; }
.warn-box .promo-icon { background: var(--warn); color: #1a1000; }
.form-actions.row { justify-content: flex-start; flex-wrap: wrap; gap: 8px; }

/* ==========================================================================
   UTILISATEURS ET DROITS (administrateurs)
   ========================================================================== */
.nav-group { display: flex; flex-direction: column; gap: 4px; margin-top: 14px; }
.nav-group[hidden] { display: none; }
.nav-label { padding: 0 12px 4px; font-size: 11px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; color: var(--faint); }
@media (max-width: 960px) {
  .nav-group { flex-direction: row; gap: 2px; margin: 0; }
  .nav-label { display: none; }
}
.stats-4 { grid-template-columns: repeat(4, 1fr); margin-bottom: 20px; }
@media (max-width: 640px) { .stats-4 { grid-template-columns: repeat(2, 1fr); } }
.select-filter { width: auto; min-width: 190px; }
.page-head + .stats, .stats + .card { margin-top: 0; }
[data-page="utilisateurs"] .card + .card { margin-top: 20px; }
.row-actions .btn span { margin-left: 2px; }

.rights-table { max-height: none; }
.rights-table th[scope="row"] { font-weight: 500; color: var(--text); white-space: normal; text-transform: none; letter-spacing: 0; font-size: 13.5px; background: none; position: static; }
.rights-table td { text-align: center; width: 130px; }
.rights-table thead th:not(:first-child) { text-align: center; }
.right-yes .icon { color: var(--ok); }
.right-no .icon { color: var(--faint); }
.rights-notes { margin: 14px 0 0; padding-left: 18px; line-height: 1.6; }

.role-chooser { border: 0; padding: 0; margin: 16px 0 0; display: grid; gap: 8px; }
.role-chooser legend { margin-bottom: 8px; padding: 0; }
.role-option { position: relative; display: block; cursor: pointer; }
.role-option input { position: absolute; opacity: 0; inset: 0; z-index: 1; margin: 0; cursor: pointer; }
.role-card { display: flex; flex-direction: column; gap: 3px; padding: 12px 14px 12px 40px; border-radius: var(--radius-md); border: 1px solid var(--line-strong); background: var(--panel-2); transition: border-color .15s, background .15s; position: relative; }
.role-card::before { content: ""; position: absolute; left: 14px; top: 15px; width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--muted); }
.role-card strong { font-size: 14px; }
.role-card span { font-size: 12.5px; color: var(--muted); line-height: 1.4; }
.role-option input:checked + .role-card { border-color: var(--accent); background: var(--accent-soft); }
.role-option input:checked + .role-card::before { border-color: var(--accent); background: radial-gradient(circle, var(--accent) 0 3px, transparent 4px); }
.role-option input:focus-visible + .role-card { outline: 2px solid var(--accent); outline-offset: 2px; }
.role-option input:disabled + .role-card { opacity: 0.55; cursor: not-allowed; }

.credentials { margin: 14px 0; padding: 14px; border-radius: var(--radius-md); background: var(--bg); border: 1px solid var(--line-strong); font: 13px/1.6 var(--font-mono); white-space: pre-wrap; word-break: break-all; color: var(--text); }
.modal { max-height: calc(100vh - 32px); overflow-y: auto; }

/* ==========================================================================
   AIDE ET TUTORIELS
   ========================================================================== */
.help-bar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 24px; border-bottom: 1px solid var(--line);
  background: var(--glass); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
}
.help-bar .brand-mark { width: 34px; height: 34px; border-radius: 10px; }
.help-layout { display: grid; grid-template-columns: 290px minmax(0, 1fr); gap: 40px; max-width: 1280px; margin: 0 auto; padding: 28px 24px 40px; align-items: start; }
.help-toc { position: sticky; top: 84px; max-height: calc(100vh - 100px); overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding-right: 6px; scrollbar-width: thin; }
.help-toc #helpCount { margin: 0 2px; }
.toc-group { margin-top: 8px; }
.toc-group[hidden], .help-toc li[hidden] { display: none; }
.toc-title { display: block; font-size: 11.5px; font-weight: 800; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); text-decoration: none; padding: 4px 8px; }
.toc-title:hover { color: var(--text); }
.help-toc ul { list-style: none; margin: 2px 0 0; padding: 0; }
.help-toc li a { display: block; padding: 6px 8px 6px 12px; border-left: 2px solid var(--line); color: var(--muted); text-decoration: none; font-size: 13.5px; line-height: 1.35; }
.help-toc li a:hover { color: var(--text); border-left-color: var(--line-strong); }
.help-toc li a[aria-current] { color: var(--accent-text); border-left-color: var(--accent); background: var(--accent-soft); }

.help-content { min-width: 0; max-width: 860px; }
.help-hero h1 { font-size: clamp(30px, 4vw, 42px); letter-spacing: -1.2px; margin: 0 0 10px; line-height: 1.1; }
.help-hero p { font-size: 15.5px; max-width: 680px; margin: 0; }
.quick-path { list-style: none; padding: 0; margin: 22px 0 8px; display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.quick-path a { display: flex; flex-direction: column; gap: 6px; height: 100%; padding: 12px; border-radius: var(--radius-md); border: 1px solid var(--line-strong); background: var(--panel); color: var(--text); text-decoration: none; font-weight: 600; font-size: 13px; line-height: 1.3; transition: border-color .15s; }
.quick-path a:hover { border-color: var(--accent); }
.quick-path strong { width: 24px; height: 24px; border-radius: 7px; display: grid; place-items: center; background: var(--accent); color: var(--accent-ink); font-size: 12px; }
@media (max-width: 760px) { .quick-path { grid-template-columns: 1fr 1fr; } }

.help-section { margin-top: 44px; }
.help-section[hidden] { display: none; }
.help-section-title { display: flex; align-items: center; gap: 10px; font-size: 13px; font-weight: 800; letter-spacing: 1.2px; text-transform: uppercase; color: var(--accent-text); margin: 0 0 14px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.tuto { scroll-margin-top: 84px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 24px; margin-bottom: 16px; line-height: 1.65; }
.tuto[hidden] { display: none; }
.tuto h3 { font-size: 19px; letter-spacing: -0.3px; margin: 0 0 10px; line-height: 1.3; }
.tuto p, .tuto li { color: var(--text-2); }
.tuto ul { padding-left: 20px; }
.tuto li + li { margin-top: 6px; }
.tuto code, .tuto kbd { font-family: var(--font-mono); font-size: 0.88em; padding: 1px 6px; border-radius: 6px; background: var(--panel-3); border: 1px solid var(--line-strong); color: var(--text); }
.tuto kbd { border-bottom-width: 2px; }
.steps { list-style: none; counter-reset: step; padding: 0; margin: 12px 0; }
.steps li { counter-increment: step; position: relative; padding-left: 40px; min-height: 28px; }
.steps li + li { margin-top: 10px; }
.steps li::before { content: counter(step); position: absolute; left: 0; top: 0; width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-text); font-weight: 800; font-size: 13px; }
.shot { margin: 16px 0 6px; }
.shot img { display: block; width: 100%; height: auto; border-radius: var(--radius-md); border: 1px solid var(--line-strong); background: #000; }
.shot a { display: block; border-radius: var(--radius-md); }
.shot figcaption { font-size: 12.5px; color: var(--muted); margin-top: 8px; }
.shot-medium { max-width: 560px; }
.shot-narrow { max-width: 420px; }
.shot-small { max-width: 320px; }
.tv-gallery { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 8px; }
.tv-gallery .shot { margin: 0; }
@media (max-width: 640px) { .tv-gallery { grid-template-columns: 1fr; } }
.tip { margin: 14px 0 0; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--accent-soft); border-left: 3px solid var(--accent); font-size: 14px; }
.tip.warn { background: rgba(255,181,71,0.1); border-left-color: var(--warn); }
.tip a { color: var(--accent-text); }
.help-table { max-height: none; margin: 12px 0; }
.help-table th[scope="row"] { position: static; background: none; color: var(--text); font-weight: 500; text-transform: none; letter-spacing: 0; font-size: 13.5px; white-space: normal; }
.help-table td { white-space: normal; }
.faq details.tuto { padding: 0; }
.faq summary { cursor: pointer; padding: 16px 22px; font-weight: 600; list-style-position: inside; }
.faq summary:hover { color: var(--accent-text); }
.faq details p { margin: 0; padding: 0 22px 18px; }
.help-empty { padding: 40px 0; text-align: center; color: var(--muted); }
@media (max-width: 960px) {
  .help-layout { grid-template-columns: 1fr; gap: 20px; padding: 18px 16px 32px; }
  .help-toc { position: static; max-height: none; }
  .help-toc nav { display: none; }
  .help-bar { padding: 10px 16px; }
  .tuto { padding: 18px; }
}
/* Les captures sont encadrées pour ne pas se confondre avec la vraie interface */
.shot img { padding: 10px; background: var(--panel-3); border-color: var(--scroll); box-shadow: 0 12px 30px -18px rgba(0,0,0,0.9); }
.shot a:hover img { border-color: var(--accent); }
@media (max-width: 640px) { .hide-sm { display: none !important; } }

/* Bouton Aide en haut de chaque page de l'espace client, version de l'appli */
.content-top { display: flex; justify-content: flex-end; margin: -12px 0 8px; }
.app-version { padding: 6px 8px 0; font-size: 11px; color: var(--faint); }
@media (max-width: 960px) {
  .content-top { margin: 0 0 12px; }
  .app-version { display: none; }
}

/* ==========================================================================
   PERSONNALISATION PAR VERSION
   ========================================================================== */
.version-switch { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.version-switch label { position: relative; cursor: pointer; }
.version-switch input { position: absolute; inset: 0; opacity: 0; z-index: 1; margin: 0; cursor: pointer; }
.version-switch span { display: flex; flex-direction: column; gap: 2px; padding: 14px 16px; border-radius: var(--radius-md); border: 1px solid var(--line-strong); background: var(--panel); transition: border-color .15s, background .15s; }
.version-switch strong { font-size: 15px; }
.version-switch small { color: var(--muted); font-size: 12.5px; }
.version-switch input:checked + span { border-color: var(--accent); background: var(--accent-soft); }
.version-switch input:checked + span strong { color: var(--accent-text); }
.version-switch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.brand-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; padding: 12px; border-radius: var(--radius-md); background: var(--panel); border: 1px solid var(--line); }
.brand-toolbar .select { width: auto; min-width: 200px; }
.row.wrap { flex-wrap: wrap; }
.brand-group > summary { cursor: pointer; list-style: none; margin: 0; display: flex; align-items: center; gap: 10px; }
.brand-group > summary::-webkit-details-marker { display: none; }
.brand-group > summary::after { content: ""; margin-left: auto; width: 9px; height: 9px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); transition: transform .15s; }
.brand-group[open] > summary { margin-bottom: 16px; }
.brand-group[open] > summary::after { transform: rotate(-135deg); }
.brand-group > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 6px; }
.field-help { display: block; color: var(--faint); font-size: 12px; line-height: 1.4; margin-top: 2px; }
.field-switch { margin-top: 14px; }
.alert-box { display: flex; gap: 14px; align-items: flex-start; padding: 16px 18px; border-radius: var(--radius); margin-bottom: 18px; border: 1px solid var(--line-strong); background: var(--panel); }
.alert-box.danger { border-color: rgba(255,95,95,0.5); background: var(--danger-soft); }
.alert-box .icon { width: 22px; height: 22px; color: var(--danger); flex: 0 0 auto; margin-top: 2px; }
.alert-box p { margin: 4px 0 0; }
.attest-card .muted { margin: 0 0 10px; }
.attest-list { margin: 0 0 6px; padding-left: 20px; line-height: 1.6; color: var(--text-2); font-size: 14px; }
@media (max-width: 640px) { .version-switch { grid-template-columns: 1fr; } .brand-toolbar .select { min-width: 0; flex: 1; } }

/* Formulaire de signalement */
.report-form { margin-top: 20px; display: flex; flex-direction: column; gap: 14px; }
.report-form .field + .field { margin-top: 0; }
.textarea { height: auto; min-height: 120px; padding: 10px 12px; line-height: 1.5; resize: vertical; font-family: var(--font); }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.report-done { margin-top: 20px; }
.report-done:focus { outline: 2px solid var(--accent); outline-offset: 4px; }

/* Signalements (administration) */
.filter-tabs { margin-bottom: 16px; gap: 8px; }
.filter-tabs label { position: relative; cursor: pointer; }
.filter-tabs input { position: absolute; inset: 0; opacity: 0; margin: 0; z-index: 1; cursor: pointer; }
.filter-tabs span { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--panel); font-weight: 600; font-size: 13px; }
.filter-tabs input:checked + span { border-color: var(--accent); color: var(--accent-text); background: var(--accent-soft); }
.filter-tabs input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.reports-list { display: flex; flex-direction: column; gap: 14px; }
.report-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.report-dl { display: grid; grid-template-columns: 160px 1fr; gap: 6px 16px; margin: 0 0 14px; font-size: 14px; }
.report-dl dt { color: var(--muted); }
.report-dl dd { margin: 0; overflow-wrap: anywhere; }
.report-desc { white-space: pre-wrap; }
.report-dl a { color: var(--accent-text); }
.report-actions { margin-top: 10px; gap: 8px; }
.nav a .count-badge { margin-left: auto; }
@media (max-width: 640px) { .report-dl { grid-template-columns: 1fr; } .report-dl dd { margin-bottom: 8px; } }
.legal h3 { font-size: 16px; margin: 22px 0 6px; color: var(--text); }

/* ---------- Page « lien TV invalide » ---------- */
body.tv-invalid { background: #000; color: #999; display: grid; place-items: center; min-height: 100vh; margin: 0; padding: 16px; text-align: center; }
.mb-12 { margin-bottom: 12px; }
.min-w-0 { min-width: 0; }

/* ---------- Connexion : passkey et double authentification ---------- */
.or-sep { display: flex; align-items: center; gap: 12px; color: var(--muted, #a1a1aa); font-size: 13px; margin: 14px 0 10px; }
.or-sep::before, .or-sep::after { content: ""; flex: 1; height: 1px; background: var(--line, rgba(255,255,255,.12)); }
.btn-block { width: 100%; justify-content: center; }
.code-input { font-size: 22px; letter-spacing: .3em; text-align: center; }
.link-btn { background: none; border: 0; padding: 0; color: var(--accent-text, inherit); text-decoration: underline; cursor: pointer; font: inherit; }
.link-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Sécurité du compte ---------- */
.global-alert { margin: 0 0 18px; }
.alert-box.warn { border-color: rgba(255,181,71,0.5); background: rgba(255,181,71,0.08); }
.alert-box.warn .icon { color: var(--warn); }
.alert-box.ok { border-color: rgba(61,220,132,0.45); background: rgba(61,220,132,0.08); }
.alert-box.ok .icon { color: var(--ok); }
.alert-box a { color: var(--accent-text); }
.sec-block { padding: 16px 0; border-top: 1px solid var(--line); }
.sec-block:first-of-type { border-top: 0; padding-top: 4px; }
.sec-block h3 { margin: 0 0 6px; font-size: 15px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.sec-list { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 8px; }
.sec-list li { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel-2, var(--hover)); }
.sec-list li .icon { width: 18px; height: 18px; color: var(--muted); flex: 0 0 auto; }
.sec-list li .grow { flex: 1; min-width: 0; }
.sec-list li .grow > div:first-child { overflow-wrap: anywhere; }
.qr-box { display: grid; place-items: center; background: #fff; border-radius: 12px; padding: 12px; width: 220px; height: 220px; margin: 6px auto 12px; }
.qr-box img { width: 196px; height: 196px; image-rendering: pixelated; }
.secret-text { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; overflow-wrap: anywhere; background: var(--panel-3); padding: 8px 10px; border-radius: 8px; user-select: all; }
.backup-codes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 14px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 15px; background: var(--panel-3); padding: 12px 14px; border-radius: 10px; margin: 10px 0; list-style: none; }
.sec-badges { display: flex; flex-wrap: wrap; gap: 4px; }
.audit-table td { vertical-align: top; }
.audit-table .details { color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.audit-table td.nowrap { white-space: nowrap; }
.steps-list { margin: 0 0 6px; padding-left: 20px; display: grid; gap: 4px; }
.sec-block .btn { white-space: normal; max-width: 100%; text-align: left; }
.sec-list li .grow { flex: 1 1 0; }
@media (max-width: 560px) { .sec-list li { flex-wrap: wrap; } }

/* ---------- Régie, version officielle : pointage des passages ---------- */
.checkpoint-card .live-list { margin-bottom: 14px; }
.cp-row { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.cp-row .field { margin: 0; }
.cp-post { flex: 1 1 220px; }
.cp-bib { flex: 1 1 180px; }
.cp-input { font-size: 26px; height: 56px; font-weight: 800; letter-spacing: 2px; }
.cp-btn { height: 56px; }
.cp-preview { display: flex; flex-wrap: wrap; align-items: baseline; gap: 10px; min-height: 28px; margin: 12px 0 4px; }
.cp-preview .nm { font-weight: 800; }
.cp-preview .cp-next { font-weight: 800; color: var(--accent-text); }
.cp-preview .hint { color: var(--muted); font-size: 13px; }
.cp-preview .hint.warn { color: var(--warn); }
.cp-feed-title { font-size: 13px; text-transform: uppercase; letter-spacing: 1.5px; color: var(--muted); margin: 18px 0 8px; }
.cp-feed { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.cp-feed li { display: grid; grid-template-columns: 72px 56px minmax(0, 1fr) minmax(0, 1fr) auto auto; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; font-size: 13.5px; }
.cp-feed li.empty-line { display: block; color: var(--muted); }
.cp-feed .cp-clock { color: var(--muted); font-variant-numeric: tabular-nums; }
.cp-feed .cp-name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cp-feed .cp-seg { color: var(--accent-text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cp-feed small { color: var(--muted); }
@media (max-width: 720px) { .cp-feed li { grid-template-columns: 1fr auto; } .cp-feed .cp-clock, .cp-feed .cp-bibcell { display: none; } }
.step-cell { font-weight: 600; }
.modal-wide { width: min(860px, calc(100vw - 32px)); }
.splits-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px 12px; margin: 12px 0; }
.splits-grid .field { margin: 0; }
.splits-grid .label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 720px) { .splits-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Groupes de droits et courses partagées */
.member-list { max-height: 260px; overflow: auto; margin-top: 8px; padding: 4px 12px 12px; border: 1px solid var(--line); border-radius: var(--radius-md); }
.member-list .check { margin-top: 10px; }
.shared-list { display: grid; gap: 10px; margin-top: 12px; }
.shared-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px; border-radius: var(--radius-md); background: var(--panel-2); border: 1px solid var(--line); }
#activityRetentionForm .row { display: flex; gap: 8px; margin-top: 6px; }
#activityRetentionForm .input { width: 80px; padding: 6px 10px; }
#accentLocked { display: flex; align-items: center; gap: 6px; margin-top: 6px; }
#accentLocked[hidden] { display: none; }

/* Lecteurs RFID / NFC / Bluetooth (version officielle) */
.reader-add { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; margin-top: 12px; }
.reader-add .field { flex: 1 1 180px; margin: 0; }
.reader-list, .reader-log { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 8px; }
.reader-list li { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--radius-md); background: var(--panel-2); border: 1px solid var(--line); }
.reader-list li > div { flex: 1 1 200px; }
.reader-list .select { max-width: 260px; }
.reader-log { gap: 2px; max-height: 220px; overflow: auto; font-size: 13px; }
.reader-log li { padding: 3px 0; color: var(--muted); }
.reader-log li.ok { color: var(--text); }
.reader-log li.finish { color: var(--ok); font-weight: 700; }
.reader-log li.warn { color: var(--warn); }
.reader-settings { margin-top: 14px; }
.reader-settings summary { cursor: pointer; font-weight: 600; }
#rdPairBtn.armed { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 35%, transparent); }

/* Bouton « Retour » */
.back-btn .icon { width: 16px; height: 16px; }
.back-bar { margin: 0 0 14px; }
.auth-card > .back-btn { align-self: flex-start; margin-bottom: 8px; }
.tv-invalid .back-btn { margin-top: 16px; }

/* ==========================================================================
   RÉGIE : modes Préparation / Course (ordinateur portable et tablette)
   ========================================================================== */
.regie-bar { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 12px; }
.regie-bar .appbar-right { justify-content: flex-end; flex-wrap: nowrap; }
.regie-bar .appbar-left { flex-wrap: nowrap; min-width: 0; }
.mode-switch {
  display: inline-flex; padding: 4px; gap: 4px; border-radius: 14px;
  background: var(--panel-2); border: 1px solid var(--line-strong);
}
.mode-switch button {
  display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 18px; border: 0; border-radius: 10px;
  background: transparent; color: var(--muted); font: 700 14px/1 var(--font); cursor: pointer; transition: background .15s, color .15s;
}
.mode-switch button:hover { color: var(--text); background: var(--hover); }
.mode-switch button.active { background: var(--accent); color: var(--accent-ink); box-shadow: 0 6px 18px -8px var(--accent-line); }
.mode-switch button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.regie-main { max-width: 1560px; margin: 0 auto; padding: 22px 24px 48px; }

/* ---------- Mode course ---------- */
.race-top { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.race-top .eyebrow { margin-bottom: 4px; }
.race-intro { margin: 0; }
.race-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 420px); gap: 20px; align-items: start; }
.race-primary, .race-side { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.race-buzz { display: flex; flex-direction: column; gap: 12px; }
.buzzer-btn.buzzer-xl {
  min-height: clamp(260px, calc(100vh - 260px), 640px); border-radius: 32px;
  font-size: clamp(48px, 7vw, 96px); letter-spacing: 8px; gap: 14px;
}
.buzzer-btn.buzzer-xl .icon { width: clamp(40px, 5vw, 64px); height: clamp(40px, 5vw, 64px); }
.buzzer-btn.buzzer-xl small { font-size: clamp(13px, 1.4vw, 18px); letter-spacing: 3px; }
.race-checkpoint .cp-input { height: 72px; font-size: 36px; font-weight: 800; font-family: var(--font-mono); letter-spacing: 1px; }
.race-checkpoint .cp-btn { height: 72px; font-size: 18px; padding: 0 28px; }
.card-compact { padding: 16px; }
.card-compact .card-title { margin-bottom: 12px; }
.wave-list.compact .wave-row { padding: 12px; }
.wave-clock.big { font-size: 20px; }
.wave-start { height: 44px; padding: 0 18px; font-size: 14px; }
.race-side .queue-grid { grid-template-columns: 1fr; }

/* ---------- Mode préparation ---------- */
.next-step {
  display: flex; align-items: center; gap: 14px; padding: 14px 16px; margin-bottom: 16px;
  border-radius: var(--radius-md); background: var(--accent-soft); border: 1px solid var(--accent-line); color: var(--text);
}
.next-step:empty { display: none; }
.next-step > .icon { width: 22px; height: 22px; color: var(--accent-text); }
.next-step > div { flex: 1; min-width: 0; }
.prep-tabs { display: flex; gap: 6px; margin-bottom: 18px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.prep-tabs button {
  display: inline-flex; align-items: center; gap: 8px; height: 42px; padding: 0 16px; border-radius: 999px;
  border: 1px solid var(--line-strong); background: var(--panel); color: var(--muted);
  font: 600 13.5px/1 var(--font); cursor: pointer; white-space: nowrap; transition: background .15s, color .15s, border-color .15s;
}
.prep-tabs button:hover { color: var(--text); border-color: var(--line-hover); }
.prep-tabs button.active { background: var(--text); border-color: var(--text); color: var(--bg); }
.prep-tabs button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.prep-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr); gap: 20px; align-items: start; }
.prep-grid > .col { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.prep-grid .card > .card-sub { margin: -8px 0 14px; }
.tv-grid-layout { grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); }
.tv-preview { position: relative; width: 100%; aspect-ratio: 16 / 9; overflow: hidden; border-radius: var(--radius-md); background: #000; border: 1px solid var(--line-strong); display: grid; place-items: center; }
.tv-preview iframe { position: absolute; top: 0; left: 0; width: 1920px; height: 1080px; border: 0; transform-origin: 0 0; pointer-events: none; }
.tv-preview p { color: #a1a1aa; padding: 16px; text-align: center; }

/* ---------- Tablette et petits écrans ---------- */
@media (max-width: 1100px) {
  .race-layout, .prep-grid, .tv-grid-layout { grid-template-columns: 1fr; }
  .regie-main { padding: 16px; }
  .buzzer-btn.buzzer-xl { min-height: clamp(220px, 42vh, 460px); }
}
@media (max-width: 900px) {
  .regie-bar { grid-template-columns: auto 1fr; }
  .regie-bar .mode-switch { grid-column: 1 / -1; grid-row: 2; justify-self: stretch; }
  .regie-bar .mode-switch button { flex: 1; justify-content: center; }
  .hide-md { display: none !important; }
}
@media (max-width: 640px) {
  .race-checkpoint .cp-row { flex-direction: column; align-items: stretch; }
}
/* Écrans tactiles : cibles d'au moins 44 px. */
@media (pointer: coarse) {
  .btn { height: 44px; }
  .btn-sm { height: 40px; }
  .btn-icon { width: 44px; height: 44px; }
  .input, .select { height: 46px; font-size: 16px; }
}
/* Plein écran (mode course) : interface allégée. */
:fullscreen .legal-footer, :fullscreen .back-btn { display: none; }
body.regie-race .legal-footer { opacity: 0.7; }

/* ---------- Visite guidée ---------- */
.tour-spot {
  position: fixed; z-index: 200; border-radius: 14px; pointer-events: none;
  box-shadow: 0 0 0 3px var(--accent), 0 0 0 9999px var(--overlay);
  transition: left .25s, top .25s, width .25s, height .25s;
}
.tour-spot.center { box-shadow: 0 0 0 9999px var(--overlay); }
.tour-box {
  position: fixed; z-index: 201; padding: 18px; border-radius: var(--radius);
  background: var(--panel); color: var(--text); border: 1px solid var(--line-strong); box-shadow: var(--shadow-pop);
  animation: pop .2s ease-out;
}
.tour-count { font-size: 11.5px; font-weight: 700; letter-spacing: .8px; text-transform: uppercase; color: var(--accent-text); }
.tour-title { font-size: 18px; margin: 6px 0 6px; letter-spacing: -0.3px; }
.tour-text { margin: 0 0 14px; color: var(--text-2); line-height: 1.5; }
.tour-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tour-spacer { flex: 1; }
@media (prefers-reduced-motion: reduce) { .tour-spot, .tour-box { transition: none; animation: none; } }
.race-checkpoint .cp-post .select { height: 72px; font-size: 16px; }

/* ---------- Droits de personnalisation : Standard / Premium ---------- */
.tier-badge {
  display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 7px; border-radius: 999px; vertical-align: middle;
  font-size: 10.5px; font-weight: 800; letter-spacing: .4px; text-transform: uppercase; white-space: nowrap;
  border: 1px solid var(--line-strong); color: var(--muted); background: var(--panel-2);
}
.tier-badge .icon { width: 12px; height: 12px; stroke-width: 2.4; }
.tier-badge.premium { color: #7a4d00; background: linear-gradient(180deg, #ffe08a, #ffc94a); border-color: #e6ac2e; }
.tier-badge.premium.locked { filter: saturate(0.9); }
.field.locked, .switch.locked, .upload.locked { position: relative; }
.field.locked .input, .field.locked .select, .field.locked input[type="color"] { opacity: .5; cursor: not-allowed; background-color: var(--panel-3); }
.field.locked .label, .switch.locked > span:last-child { color: var(--faint); }
.switch.locked { cursor: not-allowed; }
.switch.locked .switch-ui { opacity: .45; }
.upload.locked .upload-thumb, .upload.locked .upload-actions { opacity: .5; }
/* Bloc Premium : badge à cheval sur le bord, en haut à droite du carré. */
.premium-block, .locked-block { position: relative; }
.premium-block { border-color: #e6ac2e; box-shadow: inset 0 3px 0 #ffc94a; }
.block-corner { position: absolute; top: -11px; right: 16px; z-index: 1; }
.block-corner .tier-badge { font-size: 12px; padding: 3px 10px; box-shadow: 0 2px 6px rgba(0,0,0,.18); }
.locked-block { background: var(--panel-2); }
.locked-block > summary, .locked-block > .card-title { color: var(--muted); }
.block-locked-note { display: flex; gap: 8px; align-items: flex-start; margin: 0 0 14px; padding: 10px 12px; border-radius: var(--radius-md); background: var(--panel-3); color: var(--muted); font-size: 13px; }
.block-locked-note .icon { flex: 0 0 auto; width: 16px; height: 16px; margin-top: 1px; }
.file-btn.is-disabled { pointer-events: none; opacity: .6; }
.rights-note { margin-bottom: 16px; }
.rights-note .tier-badge { margin: 0 2px; }
.rights-catalogue { display: grid; gap: 14px; max-height: 620px; overflow: auto; padding-right: 4px; scrollbar-width: thin; scrollbar-color: var(--scroll) transparent; }
.rights-block { border: 1px solid var(--line); border-radius: var(--radius-md); overflow: hidden; }
.rights-block-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 12px; background: var(--panel-2); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.rights-block-head h3 { margin: 0; font-size: 13px; }
.rights-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 12px; border-bottom: 1px solid var(--line); }
.rights-row:last-child { border-bottom: 0; }
.rights-row.changed { background: var(--accent-soft); }
.rights-label { min-width: 0; font-size: 13px; }
.tier-switch { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 999px; padding: 2px; flex: 0 0 auto; }
.tier-switch label { position: relative; cursor: pointer; }
.tier-switch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.tier-switch span { display: inline-flex; align-items: center; gap: 4px; height: 26px; padding: 0 10px; border-radius: 999px; font-size: 12px; font-weight: 700; color: var(--muted); }
.tier-switch span .icon { width: 12px; height: 12px; }
.tier-switch input:checked + span { background: var(--text); color: var(--bg); }
.tier-switch input[value="premium"]:checked + span { background: linear-gradient(180deg, #ffe08a, #ffc94a); color: #5c3a00; }
.tier-switch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 1px; }
.rights-detail { margin-top: 10px; }
.rights-detail summary { cursor: pointer; font-weight: 600; font-size: 13px; margin-bottom: 8px; }
.rights-list { max-height: 320px; }
.rights-sec-title { font-size: 11px; font-weight: 800; letter-spacing: .6px; text-transform: uppercase; color: var(--faint); margin: 12px 0 2px; }

/* Bouton de thème : coin haut droit des pages de connexion */
.auth-main { position: relative; }
.auth-top { position: absolute; top: 16px; right: 16px; }
.legal-header .row { gap: 6px; }
#rightsStatus { white-space: nowrap; }
.card-head > .row { flex-wrap: wrap; justify-content: flex-end; }
.choice-actions { flex-wrap: wrap; }
.choice-actions .btn { min-width: 0; flex: 1 1 140px; }

/* Invitation de niveau « Course » : actions réservées masquées. */
/* Course partagée : seuls les éléments partagés sont affichés (le serveur
   refuse de toute façon le reste). */
.perm-off, .is-guest [data-full-only] { display: none !important; }
.race-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 10px; margin: 0 0 16px; }
.race-name { display: inline-flex; align-items: center; gap: 8px; font-weight: 800; font-size: 17px; color: var(--text); text-decoration: none; }
.race-name:hover { text-decoration: underline; }
.race-name .icon { width: 18px; height: 18px; color: var(--accent-text); }
.guest-note { display: inline-flex; align-items: center; gap: 6px; margin: 0; }
.guest-note .icon { width: 14px; height: 14px; }
/* Mode Pilotage : arrivés à gauche, TV à droite. */
.pilot-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.pilot-grid > .col { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.pilot-grid .table-wrap { max-height: 70vh; overflow: auto; }
.is-live-row td { background: var(--accent-soft); }
@media (max-width: 1100px) { .pilot-grid { grid-template-columns: 1fr; } }

/* Partage : éléments par onglet, membres et chefs de groupe. */
.perm-tabs { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin: 8px 0 4px; }
.perm-tab { border: 1px solid var(--line); border-radius: var(--radius-md); padding: 10px 12px 6px; margin: 0; min-width: 0; }
.perm-tab legend { font-weight: 700; font-size: 13px; padding: 0 4px; }
.pill-row { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.member-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.member-row[hidden] { display: none; }
.chief-check { flex: 0 0 auto; font-size: 12px; color: var(--muted); }

/* Barre de la régie avec trois modes : plus compacte sur les écrans moyens. */
@media (max-width: 1500px) {
  .mode-switch button { padding: 0 12px; }
  #tourBtn span, .appbar .brand-name { display: none; }
}
#invitePerms > .label, #raceMembersPerms > .label { display: block; margin-top: 14px; }

/* Personnalisation : onglets par écran TV de la version choisie. */
.brand-tabs { margin-bottom: 4px; }
.brand-tab-help { margin: 0; }
#brandGroups { display: flex; flex-direction: column; gap: 20px; }
#brandGroups:not(:has(.brand-group:not([hidden]))) { display: none; }

/* Téléphone : régie. */
@media (max-width: 480px) {
  .mode-switch button { padding: 0 8px; gap: 6px; font-size: 13.5px; }
  .mode-switch button .icon { display: none; }
}
@media (max-width: 640px) {
  .toasts { left: 12px; right: 12px; bottom: 12px; max-width: none; }
  .toast { min-width: 0; }
  .toast > * { min-width: 0; overflow-wrap: anywhere; }
  .table-tools { flex-wrap: wrap; }
  .table-tools .search { flex: 1 1 100%; }
  .select-filter { min-width: 0; flex: 1 1 140px; }
}
@media (max-width: 560px) {
  .appbar { padding: 8px 10px; gap: 6px; }
  .appbar-left, .appbar-right { gap: 2px; }
  .regie-bar { gap: 6px 4px; }
  .regie-bar .appbar-right .btn-icon, .regie-bar .appbar-right .btn-sm { padding: 0 8px; min-width: 36px; }
  #connPill { padding: 0 8px; }
}
@media (max-width: 380px) {
  #tourBtn { display: none; }
}

/* Utilisateurs et groupes : sélecteur en haut des deux rubriques. */
.access-switch { margin-bottom: 18px; }
.access-switch a {
  display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 18px; border-radius: 10px;
  color: var(--muted); font: 700 14px/1 var(--font); text-decoration: none;
}
.access-switch a[hidden] { display: none; }
.access-switch a:hover { color: var(--text); background: var(--hover); }
.access-switch a.active { background: var(--accent); color: var(--accent-ink); }
.access-switch a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.access-switch .icon { width: 16px; height: 16px; }

/* Droits par groupes : fenêtre à onglets, listes, arborescence des ressources */
.acl-dialog { width: min(760px, calc(100vw - 32px)); padding: 20px 24px 24px; }
.acl-dialog-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.acl-dialog-head h2 { margin: 0 0 2px; overflow-wrap: anywhere; }
.acl-dialog-head p { margin: 0; overflow-wrap: anywhere; }
.acl-h { font-size: 14px; margin: 18px 0 8px; }
.acl-h:first-child { margin-top: 0; }
.acl-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: var(--radius-md); max-height: 320px; overflow: auto; }
.acl-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 12px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.acl-row:first-child { border-top: 0; }
.acl-main { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1 1 240px; overflow-wrap: anywhere; }
.acl-ctrl { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.acl-list.inherited .acl-row, .acl-row.inherited { color: var(--muted); background: var(--panel-2, transparent); }
.select-sm { width: auto; min-height: 34px; padding-top: 4px; padding-bottom: 4px; font-size: 13px; }
.acl-add { margin-top: 12px; }
.acl-add summary { cursor: pointer; display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.acl-add .search { margin-top: 10px; }
.acl-add-row { margin-top: 10px; gap: 8px; }
.member-list [hidden] { display: none; }
.acl-explain { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 6px; }
.acl-explain li { display: flex; gap: 8px; align-items: flex-start; }
.acl-explain li.ok .icon { color: var(--ok, #22c55e); }
.acl-explain li.ko .icon { color: var(--danger); }
.acl-info { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; }
.acl-info dt { color: var(--muted); }
.acl-info dd { margin: 0; overflow-wrap: anywhere; }
.acl-actions { display: grid; gap: 8px; justify-items: start; }
.row-link { cursor: pointer; }
.res-tree, .res-tree ul { list-style: none; margin: 0; padding: 0; }
.res-tree ul { padding-left: 22px; border-left: 1px dashed var(--line); margin-left: 16px; }
.res-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 4px 0; flex-wrap: wrap; border-bottom: 1px solid var(--line); }
.res-name { display: flex; align-items: center; gap: 6px; min-width: 0; overflow-wrap: anywhere; }
.res-toggle, .res-toggle-space { width: 32px; flex: none; }
.res-premium { margin: 0; align-items: center; }
.rights-notes { margin-top: 12px; padding-left: 18px; }
@media (max-width: 640px) {
  .acl-dialog { width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; margin: 0; border-radius: 0; padding: 16px; }
  .acl-info { grid-template-columns: 1fr; }
  .acl-info dt { margin-top: 6px; }
  .res-tree ul { padding-left: 10px; margin-left: 8px; }
}
@media (max-width: 640px) {
  .access-switch { display: flex; max-width: 100%; }
  .access-switch a { flex: 1; justify-content: center; padding: 0 8px; gap: 6px; font-size: 13.5px; min-width: 0; }
  .access-switch .icon { display: none; }
}

/* Liste déroulante des suggestions (invitation à une course) */
.combo { position: relative; }
.combo-list { position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 4px); margin: 0; padding: 4px; list-style: none; max-height: 280px; overflow: auto; background: var(--panel); border: 1px solid var(--line-strong); border-radius: var(--radius-md); box-shadow: var(--shadow-pop); }
.combo-list[hidden] { display: none; }
.combo-head { padding: 8px 10px 4px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.combo-list [role=option] { padding: 8px 10px; border-radius: 8px; cursor: pointer; overflow-wrap: anywhere; }
.combo-list [role=option]:hover, .combo-list [role=option][aria-selected=true] { background: var(--panel-2); }

/* Saisie des participants (version saisie) */
.entry-table input { min-width: 90px; }
.entry-table td { padding: 4px 6px; }
.form-actions-row { margin-top: 12px; gap: 8px; justify-content: space-between; }
/* Chronos individuels : chronomètre façon téléphone */
.solo-card { text-align: center; padding: 32px 20px; }
.solo-race { margin: 0 0 6px; font-weight: 600; overflow-wrap: anywhere; }
.solo-status { font-weight: 700; letter-spacing: .5px; text-transform: uppercase; font-size: 13px; color: var(--muted); }
body.solo-running .solo-status { color: var(--accent-text); }
.solo-after { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
/* Type Hyrox : épreuve en cours, mise en évidence à chaque Station suivante */
.solo-stage { display: grid; gap: 2px; justify-items: center; margin: 0 auto 10px; padding: 12px 16px; max-width: 520px; border-radius: var(--radius-md); background: var(--panel-2); border: 2px solid transparent; }
.solo-stage-label { font-size: 12px; font-weight: 800; letter-spacing: .6px; text-transform: uppercase; color: var(--muted); }
.solo-stage-name { font-size: clamp(24px, 6vw, 36px); line-height: 1.15; overflow-wrap: anywhere; }
.solo-stage-time { font-size: 20px; font-weight: 700; color: var(--muted); }
.solo-stage.is-new { animation: stage-new 1.6s ease-out; }
@keyframes stage-new { 0%, 35% { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); } 100% { background: var(--panel-2); border-color: transparent; } }
.solo-stage.is-new .solo-stage-label, .solo-stage.is-new .solo-stage-time { animation: stage-new-muted 1.6s ease-out; }
@keyframes stage-new-muted { 0%, 35% { color: var(--accent-ink); } }
@media (prefers-reduced-motion: reduce) { .solo-stage.is-new, .solo-stage.is-new .solo-stage-label, .solo-stage.is-new .solo-stage-time { animation: none; border-color: var(--accent); } }
.solo-laps { list-style: none; margin: 14px auto 0; padding: 0; max-width: 420px; display: grid; gap: 4px; }
.solo-laps li { display: flex; justify-content: space-between; gap: 12px; padding: 6px 10px; border-radius: var(--radius-md); background: var(--panel-2); font-size: 14px; }
.solo-laps li:first-child { font-weight: 700; }
/* Préparation (Type Hyrox) : une ligne par épreuve */
.station-rows { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 8px; }
.station-rows li { display: grid; grid-template-columns: 28px 1fr auto; align-items: center; gap: 8px; }
.station-num { font-weight: 800; color: var(--muted); text-align: right; }
.solo-splits { display: grid; gap: 10px; justify-items: start; margin: 12px 0; }
.solo-splits .table-wrap { width: 100%; max-height: 360px; }
.solo-name-form { margin: 16px 0; padding-top: 14px; border-top: 1px solid var(--line); display: grid; gap: 10px; justify-items: start; }
.solo-name-form .grid-2, .solo-name-form .field { width: 100%; }
/* Sur téléphone : le chrono occupe l'écran, gros boutons en bas (pouce). */
@media (max-width: 700px) {
  body.solo-ui .race-intro { display: none; }
  body.solo-ui.regie-race .solo-card { min-height: calc(100dvh - 250px); display: flex; flex-direction: column; justify-content: space-between; padding: 22px 16px 18px; margin: 0; }
  body.solo-ui .solo-race { display: none; }
  body.solo-ui .solo-time { font-size: 15vw; letter-spacing: -1px; margin-top: auto; }
  body.solo-ui .solo-status { margin: 10px 0 auto; }
  body.solo-ui .solo-actions, body.solo-ui .solo-after { display: grid; grid-template-columns: 1fr; gap: 12px; margin-top: 24px; }
  body.solo-ui .solo-btn { min-width: 0; min-height: 84px; font-size: 22px; border-radius: 22px; }
  body.solo-ui .solo-actions .solo-btn { min-height: 92px; font-size: 24px; }
  body.solo-ui .solo-after .solo-btn { min-height: 76px; font-size: 20px; }
}
.solo-time { font-size: clamp(56px, 15vw, 150px); font-weight: 800; line-height: 1.05; letter-spacing: -2px; font-variant-numeric: tabular-nums; }
.solo-status { margin: 8px 0 22px; }
.solo-actions { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
.solo-btn { min-width: 160px; min-height: 64px; font-size: 20px; justify-content: center; }
.solo-result-who { font-size: 20px; font-weight: 700; margin: 4px 0; overflow-wrap: anywhere; }
.solo-result-time { font-size: clamp(40px, 9vw, 72px); font-weight: 800; font-variant-numeric: tabular-nums; }
.solo-format { border: 0; padding: 0; margin: 16px 0 8px; display: grid; gap: 6px; }
.solo-preview { display: flex; justify-content: center; background: var(--panel-2); border-radius: var(--radius-md); padding: 12px; min-height: 120px; align-items: center; }
.solo-preview img { max-width: 100%; max-height: 520px; border-radius: 8px; box-shadow: var(--shadow-pop); }
a.btn.disabled { opacity: .5; pointer-events: none; }
.solo-btn:disabled { opacity: .45; cursor: not-allowed; }
/* Personnalisation course : aperçu de l'affiche de la Version Basic */
.preview-frame.poster-frame { display: flex; align-items: center; justify-content: center; padding: 14px; background: var(--panel-2); min-height: 260px; }
.preview-frame.poster-frame img { display: block; max-width: 100%; max-height: min(640px, 70vh); border-radius: 10px; box-shadow: 0 20px 50px -20px rgba(0,0,0,0.7); }
.preview-frame.busy img { opacity: .7; transition: opacity .2s; }

/* Tableau de bord : chiffres clés, tableau des courses, nouvelle course */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 18px; }
.kpi { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: var(--radius-lg, 16px); background: var(--panel); border: 1px solid var(--line); }
.kpi-icon { flex: none; width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: var(--panel-2); color: var(--text); }
.kpi-v { font-size: 28px; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
.kpi-l { font-size: 13px; color: var(--muted); }
.kpi.is-live { border-color: var(--accent); }
.kpi.is-live .kpi-icon { background: var(--accent); color: var(--accent-ink); }
.dash-table td.num { font-variant-numeric: tabular-nums; }
.dash-table th[scope=row] { font-weight: 700; text-align: left; }
.new-race-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
.new-race-btn { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line-strong); background: var(--panel-2); color: var(--text); font-weight: 700; text-decoration: none; }
.new-race-btn:hover { border-color: var(--accent); }
.new-race-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.new-race-btn[hidden] { display: none; }
.tv-links { margin-top: 16px; }
.tv-links summary { cursor: pointer; display: inline-flex; align-items: center; gap: 8px; font-weight: 700; }
.tv-link-list { display: grid; gap: 10px; margin-top: 10px; }
.tv-link-row { display: grid; grid-template-columns: 170px 1fr; gap: 10px; align-items: center; }
.tv-link-row[hidden] { display: none; }
.tv-link-name { font-weight: 600; }
@media (max-width: 640px) { .tv-link-row { grid-template-columns: 1fr; } .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .kpi { padding: 12px; gap: 10px; } .kpi-icon { width: 34px; height: 34px; } .kpi-v { font-size: 22px; } }
.dash-table .row-actions { flex-wrap: nowrap; }
@media (max-width: 640px) {
  .new-race-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .new-race-btn { padding: 10px; font-size: 14px; }
  /* Tableau des courses en cartes sur téléphone */
  .dash-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .dash-table, .dash-table tbody, .dash-table tr, .dash-table td, .dash-table th { display: block; width: 100%; }
  .dash-table tr { padding: 12px 14px; border-top: 1px solid var(--line); }
  .dash-table tr:first-child { border-top: 0; }
  .dash-table th[scope=row] { padding: 0 0 6px; font-size: 16px; }
  .dash-table td { display: flex; justify-content: space-between; gap: 12px; padding: 3px 0; border: 0; }
  .dash-table td[data-label]::before { content: attr(data-label); color: var(--muted); font-size: 13px; font-family: var(--font); }
  .dash-table td.dash-actions { padding-top: 8px; }
  .dash-table td.table-empty { display: block; }
}

/* Application installable */
.install-promo { align-items: center; }
.install-icon { background: transparent; padding: 0; }
.install-icon img { width: 40px; height: 40px; border-radius: 10px; display: block; }
.install-actions { margin-left: auto; gap: 8px; }
.offline-page { min-height: 100vh; display: grid; place-items: center; background: var(--bg); color: var(--text); font-family: var(--font); padding: 24px; }
.offline-box { max-width: 460px; text-align: center; display: grid; gap: 12px; justify-items: center; }
.offline-box img { border-radius: 22px; }
@media (max-width: 640px) { .install-actions { margin-left: 0; } }
.brand-mark.app-logo { background: transparent; box-shadow: none; overflow: hidden; }
.brand-mark.app-logo img { padding: 0; object-fit: cover; }

/* Menu du compte : bouton avatar, liste déroulante */
.me-wrap { position: relative; flex: 1; min-width: 0; }
.me { width: 100%; border: 0; background: transparent; color: inherit; font: inherit; text-align: left; cursor: pointer; padding: 6px; border-radius: 12px; }
.me:hover, .me[aria-expanded="true"] { background: var(--panel-2); }
.me:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.me-name, .me-mail { display: block; }
.me-chevron { margin-left: auto; color: var(--muted); display: inline-flex; }
.avatar { overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar.has-photo { background: transparent; }
.avatar-lg { width: 42px; height: 42px; font-size: 18px; }
.avatar-xl { width: 88px; height: 88px; font-size: 36px; }
.avatar.busy { opacity: .5; }
.me-menu { position: absolute; left: 0; bottom: calc(100% + 10px); z-index: 60; min-width: 250px; padding: 6px; border-radius: 14px; border: 1px solid var(--line-strong); background: var(--panel); box-shadow: var(--shadow-pop); display: grid; gap: 2px; }
.me-menu[hidden] { display: none; }
.me-menu-head { display: flex; align-items: center; gap: 10px; padding: 8px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.me-menu-head strong, .me-menu-head small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 180px; }
.me-menu-head small { color: var(--muted); }
.me-menu [role=menuitem] { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; border: 0; border-radius: 10px; background: transparent; color: var(--text); font: inherit; font-weight: 600; font-size: 14px; text-decoration: none; text-align: left; cursor: pointer; }
.me-menu [role=menuitem]:hover, .me-menu [role=menuitem]:focus-visible { background: var(--panel-2); outline: none; }
.me-menu [role=menuitem].danger-text { color: var(--danger); }
.avatar-edit { display: flex; align-items: center; gap: 18px; margin-bottom: 16px; flex-wrap: wrap; }
.avatar-edit p { margin: 4px 0 10px; }
@media (max-width: 960px) {
  .me-text, .me-chevron { display: none; }
  .me-wrap { flex: 0 0 auto; }
  .me { padding: 2px; width: auto; }
  .me-menu { bottom: auto; top: calc(100% + 10px); left: auto; right: 0; max-width: calc(100vw - 24px); }
}
