/* Assidia : la carte de séances en papier, avec ses tampons. Mobile d'abord, boutons de 44 px minimum. */

@font-face {
  font-family: 'Fraunces';
  src: url('/fonts/fraunces.woff2') format('woff2');
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: 'Instrument Sans';
  src: url('/fonts/instrument-sans.woff2') format('woff2');
  font-weight: 400 700;
  font-display: swap;
}

:root {
  --paper: #f6f1e7;
  --paper-2: #efe6d6;
  --card: #fffdf8;
  --line: #e4d9c6;
  --line-2: #d2c3a8;
  --ink: #1e1b16;
  --ink-2: #4a443a;
  --ink-3: #7a7163;
  --pine: #1f4e45;
  --pine-2: #2b6559;
  --pine-soft: #dfeae4;
  --stamp: #d4452a;
  --stamp-soft: #f9e0d7;
  --amber: #b97a12;
  --amber-soft: #f7e7c6;
  --ok: #2f7a4f;
  --ok-soft: #dcefe2;
  --radius: 20px;
  --radius-sm: 13px;
  --shadow: 0 1px 0 rgba(30, 27, 22, 0.04), 0 10px 28px -16px rgba(30, 27, 22, 0.28);
  --display: 'Fraunces', ui-serif, Georgia, serif;
  --sans: 'Instrument Sans', ui-sans-serif, -apple-system, 'Segoe UI', sans-serif;
  --tabbar: 68px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
/* Grain de papier. */
body.paper {
  background-color: var(--paper);
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.35 0 0 0 0 0.28 0 0 0 0 0.18 0 0 0 0.09 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"),
    radial-gradient(1200px 600px at 110% -10%, rgba(31, 78, 69, 0.07), transparent 60%),
    radial-gradient(900px 500px at -20% 110%, rgba(212, 69, 42, 0.05), transparent 60%);
  background-attachment: fixed;
  min-height: 100vh;
}

a { color: var(--pine); text-underline-offset: 3px; }
button, input, select, textarea { font: inherit; color: inherit; }
img, svg { display: block; }
[hidden] { display: none !important; }

h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
.display, h1 {
  font-family: var(--display);
  font-variation-settings: 'SOFT' 100, 'WONK' 0, 'opsz' 72;
  font-weight: 560;
  line-height: 1.08;
}
h1 { font-size: clamp(1.9rem, 6vw, 2.4rem); }
h2 { font-family: var(--display); font-variation-settings: 'SOFT' 100, 'opsz' 36; font-size: 1.3rem; font-weight: 600; }
h3 { font-size: 1rem; font-weight: 650; }
p { margin: 0 0 0.8em; }
.eyebrow {
  font-size: 0.74rem;
  font-weight: 650;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin: 0 0 6px;
}
.muted { color: var(--ink-3); }
.small { font-size: 0.86rem; }
.num { font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }

/* ---------- Boutons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 0 20px;
  border-radius: 999px;
  border: 1.5px solid var(--line-2);
  background: var(--card);
  color: var(--ink);
  font-weight: 620;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.12s ease, background-color 0.15s ease, box-shadow 0.15s ease;
  user-select: none;
}
.btn:active { transform: scale(0.97); }
.btn:focus-visible, .chip-btn:focus-visible, .row:focus-visible, .tab:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--pine) 45%, transparent);
  outline-offset: 2px;
}
.btn-primary { background: var(--pine); border-color: var(--pine); color: #fff; box-shadow: 0 8px 18px -10px rgba(31, 78, 69, 0.8); }
.btn-primary:hover { background: var(--pine-2); }
.btn-stamp { background: var(--stamp); border-color: var(--stamp); color: #fff; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--pine); padding: 0 12px; }
.btn-ghost:hover { background: rgba(31, 78, 69, 0.07); }
.btn-danger { color: var(--stamp); border-color: color-mix(in srgb, var(--stamp) 40%, var(--line)); }
.btn-block { width: 100%; }
.btn-sm { min-height: 44px; padding: 0 14px; font-size: 0.92rem; }
.btn[disabled] { opacity: 0.55; pointer-events: none; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }
.btn-row > .btn { flex: 1 1 auto; }

/* ---------- Champs ---------- */
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field > span, .field > label { font-size: 0.88rem; font-weight: 620; color: var(--ink-2); }
.field small { color: var(--ink-3); font-size: 0.82rem; }
input:not([type]), input[type='text'], input[type='email'], input[type='password'], input[type='tel'], input[type='number'], input[type='date'], input[type='time'], input[type='search'], select, textarea {
  width: 100%;
  min-height: 48px;
  padding: 10px 14px;
  border: 1.5px solid var(--line-2);
  border-radius: var(--radius-sm);
  background: var(--card);
  outline: none;
  transition: border-color 0.15s ease;
}
input:focus, select:focus, textarea:focus { border-color: var(--pine); }
textarea { min-height: 110px; resize: vertical; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 0 12px; align-items: end; }
.grid-2 > * { min-width: 0; }
.check { display: flex; align-items: center; gap: 12px; min-height: 44px; cursor: pointer; }
.check input { width: 22px; height: 22px; accent-color: var(--pine); }

.segmented { display: flex; flex-wrap: wrap; gap: 8px; }
.segmented label { position: relative; }
.segmented input { position: absolute; opacity: 0; inset: 0; }
.segmented span {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1.5px solid var(--line-2);
  background: var(--card);
  font-weight: 600;
  cursor: pointer;
}
.segmented input:checked + span { background: var(--pine); border-color: var(--pine); color: #fff; }
.segmented input:focus-visible + span { outline: 3px solid color-mix(in srgb, var(--pine) 45%, transparent); }
.chip-new {
  min-height: 44px; padding: 0 16px; border-radius: 999px; border: 1.5px dashed var(--line-2);
  background: transparent; color: var(--pine); font: inherit; font-weight: 600; cursor: pointer;
}
.chip-new:hover { border-color: var(--pine); }
.chip-new-form { display: flex; gap: 8px; align-items: center; flex: 1 1 220px; }
.chip-new-form input { position: static; opacity: 1; flex: 1; min-width: 0; min-height: 44px; }
.chip-new-form[hidden], .chip-new[hidden] { display: none; }
.group-label { margin: 14px 0 2px; font-size: 0.78rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-3); }
.group-label:first-child { margin-top: 0; }

/* ---------- Pastilles de statut ---------- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 650;
  background: var(--paper-2);
  color: var(--ink-2);
  white-space: nowrap;
}
.chip::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: 0.7; }
.chip.plain::before { display: none; }
.chip-active, .chip-done, .chip-ok { background: var(--ok-soft); color: var(--ok); }
.chip-bientot, .chip-warn, .chip-roll { background: var(--amber-soft); color: var(--amber); }
.chip-terminee, .chip-negative, .chip-expiree, .chip-bad, .chip-cancelled { background: var(--stamp-soft); color: var(--stamp); }
.chip-upcoming, .chip-planned, .chip-info { background: var(--pine-soft); color: var(--pine); }
.chip-closed { background: var(--paper-2); color: var(--ink-3); }

.chip-btn {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1.5px solid var(--line-2);
  background: var(--card);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  white-space: nowrap;
}
.chip-btn[aria-pressed='true'] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.chip-scroller { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 8px; margin: 0 -2px; scrollbar-width: none; }
.chip-scroller::-webkit-scrollbar { display: none; }

/* ---------- Cartes et listes ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}
.card + .card, .section + .section { margin-top: 14px; }
.card-tight { padding: 6px 0; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.card-head h2, .card-head h3 { flex: 1; }
.section { margin-top: 26px; }
.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin: 0 4px 10px; }
.section-title h2 { font-size: 1.15rem; }

.list { list-style: none; margin: 0; padding: 0; }
.row {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 60px;
  padding: 10px 16px;
  border-top: 1px solid var(--line);
  text-decoration: none;
  color: inherit;
  background: none;
  border-left: 0; border-right: 0; border-bottom: 0;
  width: 100%;
  text-align: left;
  cursor: pointer;
}
.list > li:first-child > .row, .list > .row:first-child { border-top: 0; }
.row:hover { background: rgba(31, 78, 69, 0.035); }
.row-main { flex: 1; min-width: 0; }
.row-title { font-weight: 640; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-sub { font-size: 0.86rem; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-time { font-family: var(--display); font-variation-settings: 'opsz' 24; font-size: 1.08rem; font-weight: 600; min-width: 52px; font-variant-numeric: tabular-nums; }
.row-end { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.row.is-cancelled .row-title { text-decoration: line-through; text-decoration-color: var(--stamp); color: var(--ink-3); }

.avatar {
  width: 42px; height: 42px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-family: var(--display);
  font-weight: 650;
  background: var(--pine-soft);
  color: var(--pine);
  flex-shrink: 0;
}

.remaining { text-align: right; line-height: 1.1; }
.remaining b { font-family: var(--display); font-size: 1.35rem; font-weight: 640; font-variant-numeric: tabular-nums; }
.remaining small { display: block; font-size: 0.74rem; color: var(--ink-3); }

.empty { text-align: center; padding: 26px 18px; color: var(--ink-3); }
.empty .display { color: var(--ink); font-size: 1.4rem; margin-bottom: 8px; }

.alert {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  background: var(--amber-soft);
  color: #5d4310;
}
.alert-bad { background: var(--stamp-soft); color: #7a2414; }
.alert-info { background: var(--pine-soft); color: var(--pine); }

/* Feuille d'une séance : le solde du client et « Enregistrer un paiement ». */
.session-balance {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  margin: 4px 0 14px; padding: 10px 12px; border-radius: var(--radius-sm);
  background: var(--paper-2); font-size: 0.93rem;
}
.session-balance .chip { margin-left: 4px; }

.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 0.94rem; }
.kv dt { color: var(--ink-3); }
.kv dd { margin: 0; overflow-wrap: anywhere; }

.divider { height: 1px; background: var(--line); margin: 16px 0; border: 0; }

/* ---------- La carte de séances (tampons) ---------- */
.ticket {
  position: relative;
  background: var(--card);
  border-radius: 22px;
  padding: 22px 22px 18px;
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
  overflow: hidden;
}
/* Pointillés et encoches latérales d'une carte à poinçonner. */
.perf { position: relative; border-top: 2px dashed var(--line-2); margin: 0 -22px 14px; }
.perf::before, .perf::after {
  content: '';
  position: absolute;
  top: -14px;
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--paper);
  box-shadow: inset 0 0 0 1px var(--line);
}
.perf::before { left: -14px; }
.perf::after { right: -14px; }
.ticket-sm .perf { margin: 0 -18px 12px; }
.ticket-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.ticket-name { font-weight: 650; color: var(--ink-2); font-size: 0.92rem; }
.big-number {
  display: flex; align-items: baseline; gap: 10px;
  margin: 6px 0 2px;
}
.big-number b {
  font-family: var(--display);
  font-variation-settings: 'SOFT' 100, 'WONK' 1, 'opsz' 144;
  font-weight: 620;
  font-size: clamp(5.2rem, 26vw, 7.5rem);
  line-height: 0.86;
  letter-spacing: -0.04em;
  color: var(--pine);
  font-variant-numeric: lining-nums;
}
.ticket.is-low .big-number b { color: var(--amber); }
.ticket.is-out .big-number b { color: var(--stamp); }
.big-number span { font-size: 1.05rem; color: var(--ink-2); font-weight: 600; line-height: 1.2; }
.big-number span small { display: block; color: var(--ink-3); font-weight: 500; }
.holes {
  display: grid;
  grid-template-columns: repeat(var(--cols, 5), 1fr);
  gap: 10px;
  margin: 22px 0 12px;
}
.hole {
  aspect-ratio: 1;
  border-radius: 50%;
  max-width: 44px;
  justify-self: center;
  width: 100%;
  position: relative;
  animation: pop 0.34s cubic-bezier(0.2, 1.4, 0.4, 1) both;
  animation-delay: calc(var(--i, 0) * 30ms + 120ms);
}
/* Séance restante : une pastille pleine, c'est ce que le client a encore. */
.hole.left {
  background: radial-gradient(circle at 35% 30%, var(--pine-2), var(--pine) 72%);
  box-shadow: inset 0 0 0 3px rgba(255, 255, 255, 0.16), 0 3px 8px -4px rgba(31, 78, 69, 0.7);
}
.ticket.is-low .hole.left { background: radial-gradient(circle at 35% 30%, #d79a2b, var(--amber) 72%); box-shadow: inset 0 0 0 3px rgba(255, 255, 255, 0.18); }
/* Séance faite : grisée et cochée. */
.hole.used { background: var(--paper-2); box-shadow: inset 0 0 0 1.5px var(--line-2); }
.hole.used::after {
  content: '';
  position: absolute;
  inset: 27%;
  background: var(--ink-3);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4 12.5l5 5L20 6.5' fill='none' stroke='black' stroke-width='3.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4 12.5l5 5L20 6.5' fill='none' stroke='black' stroke-width='3.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
}
/* Séance à régler : hachurée en rouge, la seule couleur d'alerte. */
.hole.debt { background: repeating-linear-gradient(45deg, var(--stamp-soft) 0 5px, #fff 5px 9px); box-shadow: inset 0 0 0 2px var(--stamp); }
/* Séance prévue dans les prochains jours : pas encore décomptée, comme un prélèvement à venir (horloge et flèche). */
.hole.booked { background: var(--pine-soft); box-shadow: inset 0 0 0 2px var(--pine); }
.hole.booked::after {
  content: '';
  position: absolute;
  inset: 22%;
  background: var(--pine);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20.5 12a8.5 8.5 0 1 1-2.6-6.1'/%3E%3Cpath d='M20.6 3.6v4.6H16'/%3E%3Cpath d='M12 7.5V12l3 2'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20.5 12a8.5 8.5 0 1 1-2.6-6.1'/%3E%3Cpath d='M20.6 3.6v4.6H16'/%3E%3Cpath d='M12 7.5V12l3 2'/%3E%3C/svg%3E") center / contain no-repeat;
}
/* Prévue mais aucun paiement ne la couvre : elle sera à régler. */
.hole.booked.unpaid { background: var(--stamp-soft); box-shadow: inset 0 0 0 2px var(--stamp); }
.hole.booked.unpaid::after { background: var(--stamp); }
/* Plusieurs paiements : le nom de chacun au-dessus de ses pastilles. */
.holes-break { grid-column: 1 / -1; font-size: 0.8rem; font-weight: 650; color: var(--ink-3); margin-top: 4px; }
.holes-break:not(:first-child) { padding-top: 10px; border-top: 1px dashed var(--line-2); margin-top: 2px; }
@keyframes pop {
  from { transform: scale(0.4); opacity: 0; }
}
/* Légende sous les pastilles. */
.holes-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 0 0 16px; font-size: 0.85rem; color: var(--ink-2); }
.holes-legend span { display: inline-flex; align-items: center; gap: 7px; }
.holes-legend .hole { width: 15px; max-width: 15px; flex-shrink: 0; animation: none; box-shadow: inset 0 0 0 1.5px var(--line-2); }
.holes-legend .hole.left { box-shadow: none; }
.holes-legend .hole.debt { box-shadow: inset 0 0 0 1.5px var(--stamp); }
.holes-legend .hole.used::after { inset: 18%; }
.holes-legend .hole.booked { box-shadow: inset 0 0 0 1.5px var(--pine); }
.holes-legend .hole.booked.unpaid { box-shadow: inset 0 0 0 1.5px var(--stamp); }
.holes-legend .hole.booked::after { inset: 12%; }
.scope-lines { list-style: none; padding: 0; margin: 10px 0 0; font-size: 0.9rem; color: var(--ink-2); }
.scope-lines li + li { margin-top: 2px; }
.scope-lines b { color: var(--pine); font-family: var(--display); font-size: 1.05rem; }
.ticket-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 0.9rem; color: var(--ink-2); flex-wrap: wrap; }
.ticket-foot b { color: var(--ink); }
.ticket-sm { padding: 18px; }
.ticket-sm .big-number b { font-size: 4rem; }
.ticket-sm .holes { gap: 7px; margin: 16px 0 10px; }
.ticket-sm .holes-legend { margin-bottom: 12px; }

/* ---------- App du coach ---------- */
.app-shell { max-width: 680px; margin: 0 auto; padding: 0 16px calc(var(--tabbar) + var(--safe-bottom) + 96px); }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 10px;
  padding: 14px 0 12px;
  background: linear-gradient(var(--paper) 82%, rgba(246, 241, 231, 0));
}
.topbar h1 { flex: 1; font-size: 1.7rem; }
.topbar .back { width: 44px; height: 44px; border-radius: 50%; border: 1.5px solid var(--line-2); background: var(--card); display: grid; place-items: center; cursor: pointer; text-decoration: none; color: var(--ink); }
.brand { font-family: var(--display); font-variation-settings: 'SOFT' 100, 'WONK' 1; font-weight: 650; font-size: 1.15rem; color: var(--pine); text-decoration: none; display: inline-flex; align-items: center; gap: 8px; }
.brand-mark { width: 26px; height: 26px; }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; justify-content: center;
  padding: 0 8px var(--safe-bottom);
  background: var(--ink);
  border-top-left-radius: 22px; border-top-right-radius: 22px;
  box-shadow: 0 -10px 30px -18px rgba(0, 0, 0, 0.5);
}
.tabbar nav { display: flex; width: 100%; max-width: 680px; }
.tab {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  height: var(--tabbar);
  color: rgba(246, 241, 231, 0.6);
  text-decoration: none;
  font-size: 0.72rem;
  font-weight: 620;
  letter-spacing: 0.01em;
}
.tab svg { width: 23px; height: 23px; }
.tab { white-space: nowrap; }
.tab-home { flex: 1.35; }
.tab-icon { position: relative; display: inline-flex; }
.tab-badge {
  position: absolute; top: -6px; left: 13px; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px; background: var(--stamp); color: #fff; border: 2px solid var(--ink);
  font-size: 0.66rem; font-weight: 750; line-height: 14px; text-align: center; letter-spacing: 0;
}
.tab-badge[hidden] { display: none; }
.tab[aria-current='page'] { color: var(--paper); }
.tab[aria-current='page'] svg { color: #f2b8a6; }

.bottom-actions {
  position: fixed; left: 0; right: 0; z-index: 25;
  bottom: calc(var(--tabbar) + var(--safe-bottom) + 12px);
  display: flex; justify-content: center; pointer-events: none;
  padding: 0 16px;
}
.bottom-actions .inner { width: 100%; max-width: 648px; display: flex; gap: 10px; justify-content: flex-end; }
.bottom-actions .btn { pointer-events: auto; box-shadow: 0 12px 26px -12px rgba(31, 78, 69, 0.9); }
.no-tabbar .bottom-actions { bottom: calc(var(--safe-bottom) + 14px); }
.no-tabbar .toast, .eleve .toast { bottom: calc(var(--safe-bottom) + 20px); }
.no-tabbar .app-shell { padding-bottom: 120px; }

.hello { margin: 0 0 18px; padding-top: 22px; }
.hello h1 { font-size: clamp(2rem, 8vw, 2.6rem); }
.hello h1 em { font-style: italic; font-variation-settings: 'SOFT' 100, 'WONK' 1, 'opsz' 72; color: var(--pine); }

.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat { padding: 14px 16px; border-radius: var(--radius-sm); background: var(--ink); color: var(--paper); }
.stat b { display: block; font-family: var(--display); font-size: 2rem; font-weight: 600; line-height: 1; font-variant-numeric: tabular-nums; }
.stat span { font-size: 0.82rem; opacity: 0.75; }

/* ---------- Tableau de bord : vos chiffres ---------- */
.fin { margin-top: 0; }
.fin + .fin { margin-top: 22px; }
.fin + .recap { margin-top: 22px; }
.fin + .layout-2 > .col:first-child > .section:first-child, .recap + .layout-2 > .col:first-child > .section:first-child { margin-top: 26px; }
.fin-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 0 4px 10px; }
.fin-head h2 { font-size: 1.15rem; }
.month-nav { display: flex; align-items: center; gap: 0; }
.month-nav b { min-width: 7.5ch; text-align: center; font-size: 0.95rem; white-space: nowrap; }
.month-nav .btn { min-width: 40px; min-height: 40px; padding: 0; font-size: 1.35rem; line-height: 1; }
.month-nav .btn:disabled { opacity: 0.3; cursor: default; background: transparent; }
.kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.kpi {
  display: flex; flex-direction: column; gap: 4px; min-width: 0;
  padding: 14px 15px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--card); box-shadow: var(--shadow); color: var(--ink); text-align: left; font: inherit;
}
.kpi-label .dot { margin-right: 5px; }
.kpi-label { font-size: 0.72rem; font-weight: 650; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); }
.kpi-value { font-family: var(--display); font-size: 1.65rem; font-weight: 600; line-height: 1.05; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.kpi-value.is-due { color: var(--stamp); }
.kpi-sub { font-size: 0.82rem; color: var(--ink-3); }
.kpi-split { display: flex; flex-wrap: wrap; gap: 2px 14px; font-size: 0.88rem; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.kpi-trend { font-size: 0.8rem; font-weight: 600; color: var(--ink-2); }
.kpi-trend.is-up { color: var(--pine); }
.kpi-hero { grid-column: 1 / -1; padding: 16px 18px; }
.kpi-hero .kpi-value { font-size: 2.5rem; margin: 2px 0 4px; }
.kpi-sub b { color: var(--ink-2); }
.kpi-more { align-self: flex-start; margin-top: auto; padding: 6px 0 0; border: 0; background: none; font: inherit; font-size: 0.84rem; font-weight: 650; color: var(--pine); cursor: pointer; }
.kpi-more:hover { text-decoration: underline; }
.fin-note { margin: 10px 4px 0; }
.more-link { text-align: center; margin: 8px 0 0; }
.history-nav { margin: 0 0 12px; }
.history-nav .btn { min-width: 44px; min-height: 44px; padding: 0; font-size: 1.4rem; line-height: 1; }
.history-nav .btn:disabled { opacity: 0.3; cursor: default; background: transparent; }
.history-nav-title { display: flex; flex-direction: column; align-items: center; text-align: center; }
.history-nav-title b { font-family: var(--display); font-size: 1.25rem; font-weight: 600; }
.stack > * + * { margin-top: 14px; }
.stack > .more-link { margin-top: 6px; }
.dispute-card { border-color: var(--amber); }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; vertical-align: 0; }
.dot-paid { background: #00775c; }
.dot-due { background: #e8846c; }

/* C.A. sur 12 mois : barres empilées réglé / à régler. */
.chart-legend { display: flex; gap: 12px; font-size: 0.82rem; color: var(--ink-2); white-space: nowrap; }
.chart-card { padding: 18px 14px 10px 8px; }
.chart { position: relative; height: 200px; }
.chart-grid { position: absolute; inset: 0 0 24px 0; display: flex; flex-direction: column; justify-content: space-between; }
.chart-grid > div { position: relative; height: 0; margin-left: 50px; border-top: 1px solid var(--line); }
.chart-grid > div:last-child { border-top-color: var(--line-2); }
.chart-grid span { position: absolute; right: calc(100% + 6px); top: -0.6em; font-size: 0.7rem; line-height: 1.2; color: var(--ink-3); white-space: nowrap; font-variant-numeric: tabular-nums; }
.chart-bars { position: absolute; inset: 0 0 0 50px; display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 2px; }
.bar-col {
  display: flex; flex-direction: column; height: 100%; min-width: 0; padding: 0; margin: 0;
  border: 0; border-radius: 8px 8px 4px 4px; background: transparent; font: inherit; color: inherit; cursor: pointer;
}
.bar-col:hover, .bar-col:focus-visible { background: rgba(30, 27, 22, 0.045); }
.bar-col.is-selected { background: rgba(31, 78, 69, 0.08); }
.bar-stack { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 2px; }
.bar { display: block; width: min(70%, 30px); }
.bar-stack > .bar:first-child { border-radius: 4px 4px 0 0; }
.bar-paid { background: #00775c; }
.bar-due { background: #e8846c; }
.bar-label { height: 24px; line-height: 24px; text-align: center; font-size: 0.7rem; color: var(--ink-3); white-space: nowrap; }
.bar-col.is-selected .bar-label { color: var(--ink); font-weight: 700; }
.bar-label .m-long { display: none; }
.chart-tip {
  position: absolute; top: 0; z-index: 2; display: flex; flex-direction: column; gap: 1px;
  padding: 8px 11px; border-radius: 10px; background: var(--ink); color: var(--paper);
  font-size: 0.8rem; line-height: 1.35; white-space: nowrap; pointer-events: none; box-shadow: var(--shadow);
}
.chart-tip[hidden] { display: none; }
.chart-tip .muted { color: rgba(246, 241, 231, 0.7); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
@media (min-width: 520px) {
  .bar-label .m-long { display: inline; }
  .bar-label .m-short { display: none; }
}
.stat:nth-child(2) { background: var(--pine); }

.recap { background: var(--ink); color: var(--paper); border: 0; }
.recap h2 { color: #fff; }
.recap .muted { color: rgba(246, 241, 231, 0.7); }
.recap .btn { border-color: rgba(246, 241, 231, 0.3); background: transparent; color: var(--paper); }
.recap .btn-primary { background: var(--paper); color: var(--ink); border-color: var(--paper); }

.week-nav { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.week-nav .label { flex: 1; text-align: center; font-weight: 650; }
.day-block { margin-bottom: 14px; }
.day-head { display: flex; align-items: baseline; gap: 8px; margin: 0 4px 6px; }
.day-head b { font-family: var(--display); font-size: 1.05rem; }
.day-head.is-today b { color: var(--stamp); }
.day-empty { padding: 12px 16px; color: var(--ink-3); font-size: 0.9rem; }

.roll-row { display: flex; align-items: center; gap: 14px; min-height: 64px; padding: 8px 16px; border-top: 1px solid var(--line); cursor: pointer; }
.roll-row:first-child { border-top: 0; }
.roll-row input { position: absolute; opacity: 0; pointer-events: none; }
.roll-box { width: 32px; height: 32px; border-radius: 10px; border: 2px solid var(--line-2); display: grid; place-items: center; background: var(--card); flex-shrink: 0; transition: all 0.15s ease; }
.roll-row input:checked ~ .roll-box { background: var(--pine); border-color: var(--pine); }
.roll-row input:checked ~ .roll-box::after { content: ''; width: 16px; height: 16px; background: #fff; -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4 12.5l5 5L20 6.5' fill='none' stroke='black' stroke-width='3.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4 12.5l5 5L20 6.5' fill='none' stroke='black' stroke-width='3.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat; }
.roll-row input:not(:checked) ~ .row-main .row-title { color: var(--ink-3); text-decoration: line-through; }
.roll-row input:focus-visible ~ .roll-box { outline: 3px solid color-mix(in srgb, var(--pine) 45%, transparent); }

/* ---------- Feuilles (bas d'écran) ---------- */
.sheet-backdrop {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(30, 27, 22, 0.42);
  display: flex; align-items: flex-end; justify-content: center;
  animation: fade 0.18s ease both;
}
.sheet-panel {
  width: 100%; max-width: 560px;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  background: var(--paper);
  border-radius: 26px 26px 0 0;
  padding: 10px 20px calc(22px + var(--safe-bottom));
  animation: rise 0.26s cubic-bezier(0.2, 0.9, 0.3, 1) both;
}
.sheet-panel::before { content: ''; display: block; width: 44px; height: 5px; border-radius: 3px; background: var(--line-2); margin: 2px auto 14px; }
.sheet-panel h2 { margin-bottom: 14px; font-size: 1.45rem; }
@media (min-width: 700px) {
  .sheet-backdrop { align-items: center; }
  .sheet-panel { border-radius: 26px; }
}
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { transform: translateY(40px); opacity: 0; } }

.toast {
  position: fixed; z-index: 80;
  left: 50%; transform: translateX(-50%);
  bottom: calc(var(--tabbar) + var(--safe-bottom) + 78px);
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  min-height: 52px; width: max-content; max-width: min(520px, calc(100vw - 32px));
  padding: 8px 10px 8px 18px;
  border-radius: 16px;
  background: var(--ink); color: var(--paper);
  box-shadow: 0 14px 30px -12px rgba(0, 0, 0, 0.5);
  animation: rise 0.22s ease both;
  font-weight: 560;
}
.toast button { background: transparent; border: 0; color: #f2b8a6; font-weight: 700; min-height: 44px; padding: 0 10px; cursor: pointer; }
.toast.is-error { background: var(--stamp); }
.toast.is-error button { color: #fff; }

/* ---------- Pages simples (accueil, connexion, bienvenue) ---------- */
.center-page { min-height: 100vh; display: grid; place-items: center; padding: 28px 18px; }
.sheet { width: 100%; max-width: 460px; }
.home { max-width: 460px; margin: 0 auto; padding: 40px 20px 60px; }
.home-hero { margin: 26px 0 26px; }
.home-hero h1 { font-size: clamp(2.3rem, 10vw, 3rem); }
.home-hero h1 em { font-style: italic; color: var(--stamp); font-variation-settings: 'SOFT' 100, 'WONK' 1, 'opsz' 144; }
.home-hero p { font-size: 1.08rem; color: var(--ink-2); margin-top: 12px; }
.mini-ticket { display: flex; flex-direction: column; align-items: stretch; gap: 10px; margin: 22px 0 8px; }
.mini-ticket .holes { margin: 0; padding: 0; gap: 6px; --cols: 10; }
.mini-ticket .holes-legend { margin: 0; }
.mini-ticket .hole { max-width: 26px; }
.dev-note { margin-top: 14px; padding: 12px 14px; border-radius: var(--radius-sm); border: 1.5px dashed var(--line-2); font-size: 0.9rem; overflow-wrap: anywhere; }

.steps { display: flex; gap: 6px; margin: 4px 0 22px; }
.steps i { flex: 1; height: 5px; border-radius: 3px; background: var(--line); }
.steps i.on { background: var(--pine); }

.phone-frame {
  border-radius: 34px;
  border: 8px solid var(--ink);
  background: var(--paper);
  padding: 16px 14px 18px;
  box-shadow: 0 24px 50px -24px rgba(30, 27, 22, 0.55);
  max-width: 360px;
  margin: 0 auto;
  max-height: 560px;
  overflow: hidden;
  position: relative;
}
.phone-frame::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 60px; background: linear-gradient(transparent, var(--paper)); }

/* ---------- Page client ---------- */
.eleve-main { max-width: 520px; margin: 0 auto; padding: 22px 18px 56px; }
.eleve-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 18px; }
.eleve-hello { margin: 0 0 16px; }
.eleve-hello h1 { font-size: clamp(2rem, 9vw, 2.5rem); }
.next {
  display: flex; gap: 14px; align-items: center;
  padding: 16px 18px;
  border-radius: var(--radius);
  background: var(--pine);
  color: #fff;
  margin-top: 14px;
}
.next .date-badge { width: 58px; flex-shrink: 0; text-align: center; border-radius: 14px; background: rgba(255, 255, 255, 0.12); padding: 6px 0 8px; line-height: 1.05; }
.next .date-badge small { display: block; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.1em; opacity: 0.8; }
.next .date-badge b { font-family: var(--display); font-size: 1.7rem; font-weight: 600; }
.next .muted { color: rgba(255, 255, 255, 0.75); }
.next a { color: #fff; }
.history-item { display: flex; gap: 12px; align-items: center; padding: 12px 16px; border-top: 1px solid var(--line); min-height: 56px; }
.history-item:first-child { border-top: 0; }
.history-dot { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; background: var(--line-2); }
.history-dot.counted { background: var(--stamp); }
.history-dot.free { background: var(--ok); }
.history-dot.is-card { background: var(--pine); border-radius: 3px; }
.install {
  display: flex; gap: 12px; align-items: center;
  padding: 14px 16px; margin-top: 14px;
  border-radius: var(--radius-sm);
  border: 1.5px dashed var(--line-2);
  background: rgba(255, 253, 248, 0.6);
}
.install p { margin: 0; flex: 1; font-size: 0.92rem; }
.footer-note { margin-top: 36px; font-size: 0.8rem; color: var(--ink-3); text-align: center; }
.footer-note a { color: var(--ink-3); }

.steps-list { padding-left: 20px; margin: 0 0 12px; }
.steps-list li { margin-bottom: 6px; }
.code { font-family: ui-monospace, 'SF Mono', Consolas, monospace; font-size: 0.82rem; padding: 10px 12px; background: var(--paper-2); border-radius: 10px; overflow-wrap: anywhere; user-select: all; }

.fade-in > * { animation: rise 0.4s cubic-bezier(0.2, 0.9, 0.3, 1) both; }
.fade-in > *:nth-child(2) { animation-delay: 50ms; }
.fade-in > *:nth-child(3) { animation-delay: 100ms; }
.fade-in > *:nth-child(4) { animation-delay: 150ms; }
.fade-in > *:nth-child(5) { animation-delay: 200ms; }
.fade-in > *:nth-child(n + 6) { animation-delay: 240ms; }

.loading { padding: 60px 0; text-align: center; color: var(--ink-3); }
.loading::before { content: ''; display: block; width: 26px; height: 26px; margin: 0 auto 12px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--pine); animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- Mises en page à colonnes (empilées sur mobile) ---------- */
.desk-only, .side-only { display: none !important; }
.row-main .row-title, .row-main .row-sub { display: block; }
/* Sur mobile, les colonnes s'effacent : leurs blocs s'empilent et les urgences (.prio) passent en tête. */
.layout-2, .layout-profile { display: flex; flex-direction: column; }
.layout-2 > .col, .layout-profile > .col { display: contents; }
.prio { order: -1; margin-bottom: 14px; }
.order-last { order: 99; }
.list-tools { margin-bottom: 4px; }
.class-grid .row-time { min-width: 56px; }

/* ---------- Version ordinateur : une vraie app web ---------- */
@media (min-width: 960px) {
  :root { --side: 252px; --page: 1140px; }
  .desk-only { display: revert !important; }
  .list-head.desk-only { display: grid !important; }
  .mob-only { display: none !important; }
  .side-only { display: flex !important; }

  /* Barre latérale (la barre du bas sur mobile). */
  .tabbar {
    top: 0; bottom: 0; right: auto; width: var(--side);
    flex-direction: column; justify-content: flex-start; align-items: stretch; gap: 22px;
    padding: 24px 16px 20px;
    border-radius: 0;
    box-shadow: inset -1px 0 0 rgba(246, 241, 231, 0.06);
    background:
      radial-gradient(420px 300px at 0% 100%, rgba(212, 69, 42, 0.16), transparent 70%),
      radial-gradient(380px 260px at 100% 0%, rgba(43, 101, 89, 0.45), transparent 70%),
      var(--ink);
  }
  .tabbar .brand { color: var(--paper); font-size: 1.35rem; padding: 2px 10px; text-decoration: none; }
  .tabbar .brand-mark { width: 32px; height: 32px; }
  .tabbar nav { flex-direction: column; gap: 3px; max-width: none; }
  .tab {
    flex: none; flex-direction: row; justify-content: flex-start; gap: 13px;
    height: 46px; padding: 0 14px; border-radius: 13px;
    font-size: 0.97rem; letter-spacing: 0;
    transition: background-color 0.15s ease, color 0.15s ease;
  }
  .tab svg { width: 21px; height: 21px; }
  .tab { position: relative; }
  .tab-icon { position: static; }
  .tab-badge { top: 50%; left: auto; right: 12px; transform: translateY(-50%); border: 0; height: 20px; min-width: 22px; line-height: 20px; font-size: 0.74rem; border-radius: 10px; }
  .tab:hover { background: rgba(246, 241, 231, 0.06); color: var(--paper); }
  .tab[aria-current='page'] { background: rgba(246, 241, 231, 0.11); color: #fff; }
  .side-foot { margin-top: auto; flex-direction: column; gap: 12px; padding: 14px 12px 4px; border-top: 1px solid rgba(246, 241, 231, 0.1); color: rgba(246, 241, 231, 0.75); font-size: 0.88rem; }
  .side-foot b { color: var(--paper); display: block; font-size: 0.95rem; }
  .side-foot .chip { background: rgba(246, 241, 231, 0.1); color: var(--paper); }
  .side-foot .btn { min-height: 42px; background: rgba(246, 241, 231, 0.08); border-color: rgba(246, 241, 231, 0.18); color: var(--paper); font-size: 0.9rem; }
  .side-foot .btn:hover { background: rgba(246, 241, 231, 0.14); }

  /* Contenu. */
  .app-shell { max-width: none; margin: 0 0 0 var(--side); padding: 0 44px 64px; }
  #view { max-width: var(--page); margin: 0 auto; }
  .no-tabbar .app-shell { margin-left: 0; }
  .topbar { padding: 30px 0 18px; min-height: 96px; }
  .topbar h1 { font-size: 2.3rem; }
  .hello { padding-top: 30px; margin-bottom: 26px; min-height: 96px; }
  .hello h1 { font-size: 2.9rem; }

  /* L'action principale passe dans l'en-tête, en haut à droite. */
  /* En haut à droite, centrée sur le titre de l'écran (main.js, alignActions), et elle défile avec la page. */
  .bottom-actions { position: absolute; top: 34px; bottom: auto; left: var(--side); padding: 0 44px; }
  .bottom-actions .inner { max-width: var(--page); }
  .bottom-actions .btn { box-shadow: none; }
  .no-tabbar .bottom-actions { position: fixed; left: 0; top: auto; bottom: 24px; }
  .toast, .no-tabbar .toast { bottom: 28px; left: calc(50% + var(--side) / 2); }
  .no-tabbar .toast { left: 50%; }

  .layout-2 { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(320px, 1fr); gap: 28px; align-items: start; }
  .layout-profile { display: grid; grid-template-columns: 390px minmax(0, 1fr); gap: 32px; align-items: start; }
  .layout-2 > .col, .layout-profile > .col { display: block; min-width: 0; }
  .prio { margin-bottom: 0; }
  .col > :first-child { margin-top: 0; }
  .col > * + * { margin-top: 18px; }
  .col > .section + .section { margin-top: 30px; }

  .row { padding-left: 20px; padding-right: 20px; }
  .card { padding: 22px; }
  .card-tight { padding: 6px 0; }
  .sheet-panel { max-width: 600px; padding: 14px 28px 28px; }

  /* Clients : un tableau. */
  .list-tools { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
  .list-tools input[type='search'] { max-width: 320px; margin: 0 !important; }
  .list-tools .chip-scroller { padding: 0; margin: 0; }
  .student-row, .list-head {
    display: grid;
    grid-template-columns: 42px minmax(0, 1.8fr) minmax(0, 1fr) minmax(0, 1.3fr) minmax(0, 1fr) 76px;
    gap: 16px;
  }
  .list-head { padding: 12px 20px; font-size: 0.74rem; font-weight: 650; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-3); border-bottom: 1px solid var(--line); }
  .list-head + .row { border-top: 0; }
  .student-row .col-cell { font-size: 0.92rem; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .student-row .row-end { justify-content: flex-end; }

  /* Semaine : un vrai calendrier sur 7 colonnes. */
  .week-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 10px; align-items: stretch; }
  .week-grid .day-block { margin: 0; display: flex; flex-direction: column; }
  .week-grid .day-head { flex-direction: column; gap: 0; margin: 0 4px 8px; }
  .week-grid .day-head b { font-size: 1.25rem; }
  .week-grid .card-tight { flex: 1; min-height: 460px; padding: 6px; border-radius: 16px; }
  .week-grid .list { display: flex; flex-direction: column; gap: 6px; }
  .week-grid .row {
    flex-direction: column; align-items: flex-start; gap: 3px;
    min-height: 0; padding: 9px 10px; border: 0; border-radius: 11px;
    background: var(--paper);
  }
  .week-grid .row:hover { background: var(--pine-soft); }
  .week-grid .row-time { font-size: 0.92rem; min-width: 0; }
  .week-grid .row-main { width: 100%; }
  .week-grid .row-title { font-size: 0.9rem; }
  .week-grid .row-sub { font-size: 0.78rem; }
  .week-grid .row-end .chip { height: 22px; font-size: 0.7rem; padding: 0 8px; }
  .week-grid .day-empty { padding: 10px; font-size: 0.85rem; }
  .week-grid .is-today + .card-tight { box-shadow: 0 0 0 2px var(--stamp), var(--shadow); }
  .week-nav { justify-content: flex-start; max-width: 520px; }

  /* Cours : des cartes. */
  .class-grid .list { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; padding: 0; }
  .class-grid.card-tight { background: transparent; border: 0; box-shadow: none; padding: 0; }
  .class-grid .row {
    flex-direction: column; align-items: flex-start; gap: 10px;
    padding: 20px; border: 1px solid var(--line); border-radius: var(--radius);
    background: var(--card); box-shadow: var(--shadow); min-height: 150px;
  }
  .class-grid .row-time { font-size: 1.9rem; }

  /* Réglages : deux colonnes. */
  .settings-grid { columns: 2; column-gap: 22px; }
  .settings-grid > .card { break-inside: avoid; margin: 0 0 22px; display: inline-block; width: 100%; }

  .stats { grid-template-columns: 1fr 1fr; }
  .fin + .layout-2, .recap + .layout-2 { margin-top: 30px; }
  .fin + .layout-2 > .col:first-child > .section:first-child, .recap + .layout-2 > .col:first-child > .section:first-child { margin-top: 0; }
  .fin + .fin, .fin + .recap { margin-top: 28px; }
  .kpis { grid-template-columns: minmax(0, 1.3fr) repeat(2, minmax(0, 1fr)); gap: 14px; }
  .kpi { padding: 18px 20px; }
  .kpi-hero { grid-column: auto; }
  .kpi-value { font-size: 2rem; }
  .kpi-hero .kpi-value { font-size: 2.6rem; }
  .chart { height: 240px; }
  .chart-card { padding: 22px 22px 12px 12px; }
  .chart-bars { gap: 6px; }
  .phone-frame { max-height: 620px; }

  /* Accueil : le message à gauche, la connexion à droite. */
  .home { max-width: 1160px; padding: 44px 48px 40px; }
  .home-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(380px, 440px); gap: 72px; align-items: center; min-height: calc(100vh - 170px); }
  .home-hero { margin: 0; }
  .home-hero h1 { font-size: clamp(3.4rem, 5.4vw, 4.8rem); line-height: 1.02; letter-spacing: -0.02em; }
  .home-hero p { font-size: 1.3rem; max-width: 30ch; }
  .home-hero .mini-ticket { margin: 34px 0 30px; max-width: 520px; }
  .home-hero .mini-ticket .hole { max-width: 40px; }
  .home-points { list-style: none; padding: 0; margin: 0; display: grid !important; gap: 12px; max-width: 44ch; color: var(--ink-2); }
  .home-points li { padding-left: 30px; position: relative; }
  .home-points li::before { content: ''; position: absolute; left: 0; top: 4px; width: 16px; height: 16px; border-radius: 50%; background: var(--pine); box-shadow: inset 0 0 0 3px rgba(255, 255, 255, 0.18); }
  .home-forms .card + .card { margin-top: 16px; }
}

@media (min-width: 1280px) {
  :root { --side: 268px; }
  .week-grid .card-tight { min-height: 520px; }
}

/* ---------- Tutoriel : bulles et mise en lumière ---------- */
.tour { position: fixed; inset: 0; z-index: 90; }
.tour-block { position: absolute; inset: 0; }
.tour-dim { position: absolute; inset: 0; background: rgba(30, 27, 22, 0.55); animation: fade 0.2s ease both; }
.tour-spot {
  position: fixed;
  border-radius: 16px;
  box-shadow: 0 0 0 4px rgba(246, 241, 231, 0.95), 0 0 0 9999px rgba(30, 27, 22, 0.55);
  transition: top 0.32s cubic-bezier(0.2, 0.9, 0.3, 1), left 0.32s cubic-bezier(0.2, 0.9, 0.3, 1), width 0.32s cubic-bezier(0.2, 0.9, 0.3, 1), height 0.32s cubic-bezier(0.2, 0.9, 0.3, 1);
  pointer-events: none;
}
.tour-pop {
  position: fixed;
  z-index: 2;
  width: min(380px, calc(100vw - 24px));
  background: var(--paper);
  color: var(--ink);
  border-radius: 20px;
  padding: 18px 20px 16px;
  box-shadow: 0 24px 60px -18px rgba(0, 0, 0, 0.55);
  animation: rise 0.26s cubic-bezier(0.2, 0.9, 0.3, 1) both;
}
.tour-pop.is-center { left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(460px, calc(100vw - 24px)); animation: fade 0.22s ease both; }
.tour-pop.is-docked { left: 12px; right: 12px; width: auto; }
.tour-pop h3 { font-family: var(--display); font-variation-settings: 'SOFT' 100, 'opsz' 36; font-size: 1.3rem; font-weight: 600; margin: 2px 0 8px; }
.tour-pop .tour-body { font-size: 0.95rem; color: var(--ink-2); }
.tour-pop .tour-body p { margin: 0 0 8px; }
.tour-pop .tour-body ul { margin: 0 0 8px; padding-left: 18px; }
.tour-pop .tour-body li { margin-bottom: 4px; }
.tour-pop .tour-body b { color: var(--ink); }
.tour-pop .tour-note { font-size: 0.85rem; color: var(--ink-3); font-style: italic; }
.tour-foot { display: flex; align-items: center; gap: 8px; margin-top: 12px; }
.tour-dots { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
.tour-dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--line-2); }
.tour-dots i.on { background: var(--stamp); }
.tour-foot .btn { min-height: 42px; padding: 0 16px; }
.tour-foot.is-chain { flex-wrap: wrap; }
.tour-foot.is-chain .tour-dots { flex-basis: 100%; margin-bottom: 6px; }
.tour-foot.is-chain [data-tour-chain] { flex: 1; }
.tour-skip { position: absolute; top: 10px; right: 10px; border: 0; background: transparent; color: var(--ink-3); font-size: 0.85rem; font-weight: 600; min-height: 36px; padding: 0 8px; cursor: pointer; }
.tour-emoji { font-size: 2rem; line-height: 1; margin-bottom: 4px; }

.help-list .row { cursor: default; }
.help-list .row-title { white-space: normal; }

/* ---------- Paiement : choix rapides et options repliées ---------- */
.choice-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
.choice { position: relative; }
.choice input { position: absolute; opacity: 0; inset: 0; }
.choice span {
  display: flex; flex-direction: column; gap: 2px; justify-content: center;
  min-height: 58px; padding: 8px 12px;
  border-radius: 14px; border: 1.5px solid var(--line-2); background: var(--card);
  cursor: pointer; line-height: 1.2;
}
.choice span small { color: var(--ink-3); font-size: 0.78rem; }
.choice input:checked + span { background: var(--pine); border-color: var(--pine); color: #fff; }
.choice input:checked + span small { color: rgba(255, 255, 255, 0.78); }
.choice input:focus-visible + span { outline: 3px solid color-mix(in srgb, var(--pine) 45%, transparent); }
details.more { margin: 0 0 14px; border-radius: var(--radius-sm); border: 1.5px dashed var(--line-2); padding: 0 14px; }
details.more > summary { min-height: 46px; display: flex; align-items: center; cursor: pointer; font-weight: 600; font-size: 0.9rem; color: var(--ink-2); list-style: none; }
details.more > summary::before { content: '+'; display: inline-grid; place-items: center; width: 22px; height: 22px; margin-right: 8px; border-radius: 50%; background: var(--paper-2); }
details.more[open] > summary::before { content: '−'; }
details.more[open] { padding-bottom: 4px; }
.lot-row .row-title { white-space: normal; }

/* À encaisser : si la place manque, le bouton passe sous le nom plutôt que de l'écraser. */
.collect-row { flex-wrap: wrap; row-gap: 8px; }
.collect-row .row-main { flex: 1 1 160px; }

/* ---------- Fiche client : prochaines séances ---------- */
.upcoming-count { margin: -4px 4px 10px; }
.chip-class { background: var(--paper-2); color: var(--ink-2); border: 1px solid var(--line-2); padding-block: 1px; font-size: 0.74rem; vertical-align: 1px; }
/* Page client : places restantes d'un cours collectif. */
.spots { color: var(--pine); font-weight: 650; }
.spots.is-full { color: var(--stamp); }
/* Feuille d'une séance : l'ajouter à son agenda. */
.session-cal { margin: 14px 0 0; text-align: center; color: var(--ink-3); }
.session-cal a { font-weight: 600; }
.list-month { padding: 10px 16px 6px; font-size: 0.78rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-3); background: var(--paper-2); border-top: 1px solid var(--line); }
.list-month:first-child { border-top: 0; }

/* ---------- Choix d'un client : on tape son nom, on choisit dans la liste ---------- */
.picker { position: relative; }
.picker-box { position: relative; }
.picker.is-picked .picker-box input[type='search'] { padding-left: 46px; border-color: var(--pine); font-weight: 620; }
.picker.is-picked .picker-box::before {
  content: '✓'; position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center;
  background: var(--pine); color: #fff; font-size: 0.8rem; font-weight: 700; pointer-events: none;
}
/* Liste flottante, par-dessus les champs suivants : la feuille ne bouge pas pendant qu'on choisit. */
.picker-list {
  position: absolute; left: 0; right: 0; top: 100%; z-index: 5; margin-top: 4px;
  max-height: min(264px, 38vh); overflow: auto; overscroll-behavior: contain;
  border: 1.5px solid var(--pine); border-radius: var(--radius-sm); background: var(--card);
  box-shadow: 0 18px 36px -18px rgba(30, 27, 22, 0.45);
}
.picker-option { display: flex; flex-direction: column; justify-content: center; min-height: 50px; padding: 7px 14px; border-top: 1px solid var(--line); cursor: pointer; }
.picker-option:first-child { border-top: 0; }
.picker-option.is-active { background: rgba(31, 78, 69, 0.08); }
@media (hover: hover) { .picker-option:hover { background: rgba(31, 78, 69, 0.05); } }
.picker-name { font-weight: 620; }
.picker-sub { font-size: 0.82rem; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.picker-more { margin: 0; padding: 12px 14px; font-size: 0.86rem; color: var(--ink-3); }
.picker-option + .picker-more { border-top: 1px solid var(--line); }

/* ---------- Connexion et inscription ---------- */
.auth-switch { margin: 18px 0 0; padding-top: 16px; border-top: 1px solid var(--line); text-align: center; font-size: 0.95rem; color: var(--ink-2); }
.auth-switch a { font-weight: 700; color: var(--pine); white-space: nowrap; }
.signup-hero { margin: 20px 0 20px; }
.signup-hero h1 { font-size: clamp(1.9rem, 8.5vw, 2.4rem); }
.signup-hero p { font-size: 1rem; }
.signup-steps { list-style: none; counter-reset: step; padding: 0; margin: 0; }
.signup-steps li { counter-increment: step; position: relative; padding-left: 42px; min-height: 28px; }
.signup-steps li::before {
  content: counter(step); position: absolute; left: 0; top: -2px;
  width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
  background: var(--pine); color: #fff; font-weight: 700; font-size: 0.85rem;
}
@media (min-width: 960px) {
  .signup-hero h1 { font-size: clamp(3rem, 4.6vw, 4.2rem); }
  .signup-hero p { font-size: 1.2rem; max-width: 34ch; }
  .signup-steps { display: grid !important; gap: 16px; margin-top: 34px; max-width: 46ch; color: var(--ink-2); }
}
.password-wrap { position: relative; display: block; }
.password-wrap input { padding-right: 96px; }
.password-wrap .btn { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); min-height: 40px; }
.code-input { letter-spacing: 0.25em; font-size: 1.25rem !important; text-align: center; }
.legal { max-width: 720px; margin: 0 auto; padding: 32px 20px 64px; }
.legal h1 { font-size: clamp(1.8rem, 5vw, 2.4rem); margin-bottom: 4px; }
.legal h2 { margin: 26px 0 8px; font-size: 1.2rem; }
.legal p, .legal li { color: var(--ink-2); }

/* ---------- Administration : statistiques du site ---------- */
.admin-tabs { display: flex; gap: 8px; margin: -4px 0 16px; }
.admin-periods { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 14px; }
.admin-periods .chip { text-decoration: none; padding: 5px 12px; }
.admin-kpis { margin-bottom: 4px; }
@media (min-width: 960px) { .admin-kpis { grid-template-columns: repeat(4, 1fr); } }
.admin-chart { height: 180px; }
.admin-bars { display: grid; gap: 2px; height: 100%; }
.admin-bar-col { display: flex; flex-direction: column; justify-content: flex-end; align-items: center; min-width: 0; border-radius: 6px; }
.admin-bar-col:hover { background: rgba(30, 27, 22, 0.045); }
.admin-bar { display: block; width: min(70%, 22px); min-height: 0; background: #00775c; border-radius: 4px 4px 0 0; }
.admin-bar-n { font-size: 0.66rem; color: var(--ink-3); line-height: 1.4; font-variant-numeric: tabular-nums; }
.admin-bar-label { height: 22px; line-height: 22px; font-size: 0.66rem; color: var(--ink-3); white-space: nowrap; }
.funnel-track { height: 6px; margin-top: 6px; border-radius: 99px; background: var(--paper-2); overflow: hidden; }
.funnel-track span { display: block; height: 100%; border-radius: 99px; background: var(--pine); }
.funnel-n { flex-direction: column; align-items: flex-end; gap: 0; min-width: 56px; }
.funnel-n b { font-variant-numeric: tabular-nums; font-size: 1.05rem; }
.admin-table-wrap { overflow-x: auto; }
.admin-note code { overflow-wrap: anywhere; }
.admin-plan { flex-direction: column; align-items: flex-end; gap: 4px; }
.admin-kpis + .layout-2 { margin-top: 22px; }
@media (max-width: 599px) {
  .admin-table { font-size: 0.86rem; }
  .admin-table th, .admin-table td { padding: 9px 7px; }
  .admin-table th:first-child { padding-left: 12px; }
  .admin-table th:last-child, .admin-table td:last-child { padding-right: 12px; }
  .admin-table thead th { font-size: 0.66rem; letter-spacing: 0; }
  .admin-hide-sm { display: none; }
}
.admin-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; font-variant-numeric: tabular-nums; }
.admin-table th, .admin-table td { padding: 10px 12px; text-align: right; border-top: 1px solid var(--line); white-space: nowrap; }
.admin-table thead th { border-top: 0; font-size: 0.74rem; font-weight: 650; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.04em; }
.admin-table th:first-child { text-align: left; font-weight: 600; white-space: normal; }

/* Lien dans une phrase qui ouvre une feuille (pas une page). */
.link-btn { padding: 0; border: 0; background: none; font: inherit; color: var(--pine); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
