/* Charte Adel'Flow : mauve #B398BB, texte #605953, titres Yeseva One, texte KoHo. Mobile d'abord. */
:root {
  --mauve: #B398BB;
  --mauve-dark: #8F6F9A;
  --mauve-soft: #EFE8F1;
  --mauve-line: #DCCFE0;
  --bg: #FBF9FC;
  --card: #FFFFFF;
  --ink: #3F3A45;
  --ink-2: #605953;
  --muted: #8E8794;
  --line: #E8E2EA;
  --ok: #4F8A63; --ok-soft: #E3F1E7;
  --warn: #A8843F; --warn-soft: #F5ECD8;
  --bad: #B8474F; --bad-soft: #F7E1E3;
  --info: #4F7A9E; --info-soft: #E1ECF5;
  --font-display: "Yeseva One", Georgia, serif;
  --font-body: "KoHo", "Helvetica Neue", Arial, sans-serif;
}
/* Thème sombre : appliqué si l'appareil est en sombre (sauf choix « clair »), ou si l'utilisateur a choisi « sombre ». */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --mauve: #B398BB; --mauve-dark: #C9B3D0; --mauve-soft: #2E2733; --mauve-line: #4A3F52;
    --bg: #17141A; --card: #221D27; --ink: #ECE6EF; --ink-2: #C9C1CE; --muted: #9C93A3; --line: #332C39;
    --ok: #8CCB9E; --ok-soft: #1F3326; --warn: #D9B36A; --warn-soft: #3A2F18; --bad: #E08A90; --bad-soft: #3D2226; --info: #8FB6D8; --info-soft: #1F2E3B;
  }
}
:root[data-theme="dark"] {
  --mauve: #B398BB; --mauve-dark: #C9B3D0; --mauve-soft: #2E2733; --mauve-line: #4A3F52;
  --bg: #17141A; --card: #221D27; --ink: #ECE6EF; --ink-2: #C9C1CE; --muted: #9C93A3; --line: #332C39;
  --ok: #8CCB9E; --ok-soft: #1F3326; --warn: #D9B36A; --warn-soft: #3A2F18; --bad: #E08A90; --bad-soft: #3D2226; --info: #8FB6D8; --info-soft: #1F2E3B;
}
:root { color-scheme: light dark; }
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font-body); font-size: 17px; line-height: 1.5; }
a { color: var(--mauve-dark); }
h1, h2, h3 { font-family: var(--font-display); font-weight: 400; color: var(--ink); line-height: 1.2; margin: 0 0 .4em; text-wrap: balance; }
h1 { font-size: 1.9rem; }
h2 { font-size: 1.35rem; margin-top: 1.6em; }
h3 { font-size: 1.1rem; }
p { margin: 0 0 1em; }
.muted { color: var(--muted); }
.small { font-size: .9rem; }
.right { text-align: right; }

/* En-tête */
.topbar { background: linear-gradient(135deg, var(--mauve) 0%, var(--mauve-dark) 100%); color: #fff; padding: 12px 18px; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; position: sticky; top: 0; z-index: 50; box-shadow: 0 2px 10px rgba(0,0,0,.12); }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; }
.brand img { height: 40px; width: auto; }
.brand span { font-family: var(--font-display); font-size: 1.05rem; letter-spacing: .02em; opacity: .95; }
.nav { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; }
.nav a, .nav .linkbtn { color: #fff; text-decoration: none; padding: 7px 11px; border-radius: 999px; font-size: .95rem; background: transparent; border: 0; font-family: inherit; cursor: pointer; }
.nav a.on { background: rgba(255,255,255,.22); }
.nav a:hover, .nav .linkbtn:hover { background: rgba(255,255,255,.16); }
.nav a.cta { background: #fff; color: #8F6F9A; font-weight: 600; }
.inline { display: inline; }

/* Contenu */
.wrap { max-width: 860px; margin: 0 auto; padding: 22px 16px 60px; }
.foot { max-width: 860px; margin: 0 auto; padding: 18px 16px 40px; color: var(--muted); font-size: .85rem; display: flex; gap: 18px; flex-wrap: wrap; border-top: 1px solid var(--line); }
.foot a { color: var(--muted); }

.flash { padding: 12px 16px; border-radius: 10px; margin: 0 0 14px; border-left: 4px solid; font-weight: 500; }
.flash-success { background: var(--ok-soft); border-color: var(--ok); color: var(--ink); }
.flash-error { background: var(--bad-soft); border-color: var(--bad); color: var(--ink); }
.flash-info { background: var(--info-soft); border-color: var(--info); color: var(--ink); }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; margin-bottom: 14px; }
.card.soft { background: var(--mauve-soft); border-color: var(--mauve-line); }
.stack { display: grid; gap: 12px; }
.grid2 { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* Chiffres clés */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin-bottom: 18px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.stat b { display: block; font-family: var(--font-display); font-size: 1.7rem; color: var(--mauve-dark); font-variant-numeric: tabular-nums; }
.stat span { color: var(--muted); font-size: .85rem; }

/* Planning */
.day { margin: 22px 0 8px; display: flex; align-items: baseline; gap: 10px; }
.day h2 { margin: 0; font-size: 1.15rem; }
.day .muted { font-size: .85rem; }
.seance { display: grid; grid-template-columns: 62px 1fr auto; gap: 12px; align-items: center; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; margin-bottom: 8px; }
.seance.full { border-color: var(--mauve-line); }
.seance.cancelled { opacity: .6; }
.seance .time { font-family: var(--font-display); font-size: 1.25rem; color: var(--mauve-dark); font-variant-numeric: tabular-nums; }
.seance .name { font-weight: 600; }
.seance .meta { color: var(--muted); font-size: .85rem; }
.seance .action { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
@media (max-width: 520px) {
  .seance { grid-template-columns: 56px 1fr; }
  .seance .action { grid-column: 1 / -1; flex-direction: row; justify-content: flex-end; }
}

/* Jauge de places */
.dots { display: inline-flex; gap: 3px; vertical-align: middle; }
.dots i { width: 9px; height: 9px; border-radius: 50%; background: var(--mauve-line); display: inline-block; }
.dots i.on { background: var(--mauve); }

/* Étiquettes d'état */
.chip { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: .78rem; font-weight: 600; letter-spacing: .02em; white-space: nowrap; }
.chip-confirmee, .chip-presente, .chip-ok { background: var(--ok-soft); color: var(--ok); }
.chip-attente, .chip-warn { background: var(--warn-soft); color: var(--warn); }
.chip-annulee, .chip-absente, .chip-due, .chip-bad { background: var(--bad-soft); color: var(--bad); }
.chip-info { background: var(--info-soft); color: var(--info); }
.chip-muted { background: var(--line); color: var(--ink-2); }

/* Boutons et formulaires */
.btn { display: inline-block; background: var(--mauve); color: #fff; border: 0; border-radius: 999px; padding: 9px 16px; font-family: inherit; font-size: .95rem; font-weight: 600; cursor: pointer; text-decoration: none; line-height: 1.2; }
.btn:hover { background: var(--mauve-dark); }
.btn.secondary { background: transparent; color: var(--mauve-dark); border: 1.5px solid var(--mauve); }
.btn.secondary:hover { background: var(--mauve-soft); }
.btn.danger { background: transparent; color: var(--bad); border: 1.5px solid var(--bad); }
.btn.danger:hover { background: var(--bad-soft); }
.btn.sm { padding: 6px 12px; font-size: .85rem; }
.btn:disabled { opacity: .5; cursor: default; }
.btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid rgba(179,152,187,.55); outline-offset: 2px; }

form.form { display: grid; gap: 12px; max-width: 460px; }
label { display: grid; gap: 4px; font-weight: 500; font-size: .95rem; }
label.check { grid-template-columns: auto 1fr; align-items: start; font-weight: 400; }
input[type=text], input[type=email], input[type=password], input[type=tel], input[type=date], input[type=time], input[type=number], select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--mauve-line); border-radius: 10px; font: inherit; background: var(--card); color: var(--ink);
}
textarea { min-height: 80px; resize: vertical; }
.hint { color: var(--muted); font-size: .85rem; font-weight: 400; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* Tableaux */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .95rem; }
th, td { text-align: left; padding: 9px 10px 9px 0; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; }
td.num { font-variant-numeric: tabular-nums; }
tr.dim td { color: var(--muted); }

/* Liste de personnes */
.people { list-style: none; margin: 0; padding: 0; }
.people li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.people li:last-child { border-bottom: 0; }
.people .who b { display: block; }
.people .who span { color: var(--muted); font-size: .85rem; }
.seg { display: inline-flex; border: 1px solid var(--mauve-line); border-radius: 999px; overflow: hidden; }
.seg label { display: block; cursor: pointer; }
.seg input { position: absolute; opacity: 0; width: 0; height: 0; }
.seg span { display: block; padding: 6px 12px; font-size: .85rem; font-weight: 600; color: var(--muted); }
.seg input:checked + span { background: var(--mauve); color: #fff; }
.seg input:focus-visible + span { outline: 3px solid rgba(179,152,187,.55); }

/* Filtres et lignes cliquables */
.filters { display: flex; gap: 6px; flex-wrap: wrap; margin: 4px 0 16px; }
.filter { padding: 6px 12px; border-radius: 999px; border: 1.5px solid var(--mauve-line); color: var(--mauve-dark); text-decoration: none; font-size: .88rem; font-weight: 600; }
.filter:hover { background: var(--mauve-soft); }
.filter.on { background: var(--mauve); border-color: var(--mauve); color: #fff; }
table.clickable tr[data-href] { cursor: pointer; }
table.clickable tr[data-href]:hover td { background: var(--mauve-soft); }
table.clickable tr[data-href]:focus-visible { outline: 3px solid rgba(179,152,187,.55); }
.chip-offre-abonnement { background: var(--mauve-soft); color: var(--mauve-dark); }
.chip-offre-carte20 { background: var(--ok-soft); color: var(--ok); }
.chip-offre-carte10 { background: var(--info-soft); color: var(--info); }
.chip-offre-unite { background: var(--warn-soft); color: var(--warn); }
.chip-offre-decouverte { background: var(--sand-soft, #F1E8D6); color: #8A6A2C; }

.engagement { font-size: .88rem; background: var(--warn-soft); border-left: 3px solid var(--warn); padding: 8px 12px; border-radius: 8px; margin: 0 0 10px; }
.invite summary { cursor: pointer; list-style: none; }
.invite summary::-webkit-details-marker { display: none; }
.infini { font-size: 1.15rem; color: var(--mauve-dark); font-weight: 600; line-height: 1; }

/* Tri des colonnes */
button.sort { background: none; border: 0; padding: 0; font: inherit; font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; cursor: pointer; white-space: nowrap; }
button.sort::after { content: "\2195"; margin-left: 5px; opacity: .45; font-size: .85rem; }
button.sort.asc::after { content: "\2191"; opacity: 1; color: var(--mauve-dark); }
button.sort.desc::after { content: "\2193"; opacity: 1; color: var(--mauve-dark); }
button.sort:hover, button.sort.asc, button.sort.desc { color: var(--ink); }
button.sort:focus-visible { outline: 3px solid rgba(179,152,187,.55); outline-offset: 2px; border-radius: 4px; }

/* Œil mot de passe, dans le champ */
.pwd { position: relative; display: block; width: 100%; }
.pwd input[type=password], .pwd input[type=text] { padding-right: 46px; }
.pwd-eye { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; border: 0; background: transparent; color: var(--muted); cursor: pointer; border-radius: 8px; padding: 0; }
.pwd-eye:hover { color: var(--mauve-dark); background: var(--mauve-soft); }
.pwd-eye:focus-visible { outline: 3px solid rgba(179,152,187,.55); }

/* Calendrier admin */
.calbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin: 6px 0 12px; }
.calbar .navbtn { padding: 6px 12px; font-size: 1.1rem; line-height: 1; }
.caltitle { font-family: var(--font-display); font-size: 1.15rem; margin-left: 6px; }
.calnav { display: grid; grid-template-columns: 44px minmax(0, 1fr) 44px; gap: 8px; align-items: stretch; }
.calarrow { display: flex; align-items: center; justify-content: center; color: var(--mauve); text-decoration: none; font-size: 2.6rem; line-height: 1; min-height: 120px; border-radius: 12px; }
.calarrow:hover { color: var(--mauve-dark); background: var(--mauve-soft); }
.kpis { display: flex; flex-wrap: wrap; gap: 6px 22px; color: var(--muted); font-size: .92rem; }
.kpis b { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
hr.sep { border: 0; border-top: 1px solid var(--mauve-line); margin: 14px 0 18px; }
.seg a.segl { display: block; padding: 6px 12px; font-size: .85rem; font-weight: 600; color: var(--muted); text-decoration: none; }
.seg a.segl.on { background: var(--mauve); color: #fff; }
#calzone.loading .cal { opacity: .5; transition: opacity .15s; }
.calarrow:focus-visible { outline: 3px solid rgba(179,152,187,.55); }
.cal { display: grid; gap: 8px; min-width: 0; }
.cal-semaine { grid-template-columns: repeat(7, minmax(0, 1fr)); }
.calrow { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.calday { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 8px; min-height: 120px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
body.is-admin .wrap, body.is-admin .foot { max-width: 1140px; }
.calday.out { opacity: .45; }
.calday.today { border-color: var(--mauve); box-shadow: inset 0 0 0 1px var(--mauve); }
.calday.vacances { background: var(--warn-soft); }
.calday.ferie { background: var(--info-soft); }
.calday.vacances .calhead .dom, .calday.ferie .calhead .dom { color: var(--ink); }
.tag-jour { font-size: .66rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-left: auto; }
.legende { display: inline-flex; align-items: center; gap: 6px; margin-left: 12px; }
.legende .sw { display: inline-block; width: 12px; height: 12px; border-radius: 3px; border: 1px solid var(--line); vertical-align: middle; }
.legende .sw.vacances { background: var(--warn-soft); }
.legende .sw.ferie { background: var(--info-soft); }
.calhead { display: flex; align-items: baseline; gap: 6px; white-space: nowrap; overflow: hidden; }
.calhead .mon { font-size: .72rem; color: var(--muted); }
.calhead .dow { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; }
.calhead .dom { font-family: var(--font-display); font-size: 1.05rem; color: var(--ink); }
.calday.today .dom { color: var(--mauve-dark); }
.calev { display: flex; flex-direction: column; gap: 1px; text-align: left; width: 100%; border: 1px solid var(--mauve-line); background: var(--mauve-soft); border-radius: 9px; padding: 6px 8px; font: inherit; color: var(--ink); cursor: pointer; }
.calev:hover { border-color: var(--mauve); filter: brightness(.96); }
.calev:focus-visible { outline: 3px solid rgba(179,152,187,.55); outline-offset: 1px; }
.calev .t { font-family: var(--font-display); font-size: .95rem; color: var(--mauve-dark); }
.calev .n { font-size: .82rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.calev .c { font-size: .76rem; color: var(--muted); }
.calev .c em { font-style: normal; color: var(--warn); font-weight: 600; }
.calev.full { background: var(--line); border-color: var(--line); }
.calev.full .t { color: var(--muted); }
.calev.none { background: var(--card); }
.calev.mine { background: var(--ok-soft); border-color: var(--ok); }
.calev.mine .t, .calev .c em.ok { color: var(--ok); }
.calev.waiting { background: var(--warn-soft); border-color: var(--warn); }
.calev.waiting .t, .calev.waiting .c em.ok { color: var(--warn); }
.calev.cancelled { background: var(--bad-soft); border-color: var(--bad-soft); text-decoration: line-through; opacity: .8; }
.calev.past { opacity: .7; }
.calev.pref { box-shadow: inset 0 0 0 1.5px var(--warn); }
.calev .star { color: var(--warn); font-size: .8rem; vertical-align: middle; }
.bar { height: 10px; background: var(--mauve-soft); border-radius: 999px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--mauve); border-radius: 999px; }
.bar.ok i { background: var(--ok); }
.bar.warn i { background: var(--warn); }
.settings-grid { display: grid; gap: 10px 16px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.settings-grid label input[type=number] { max-width: 140px; }
.cal-mois .calev { padding: 4px 6px; }
.cal-mois .calev .n { display: none; }
.cal-mois .calday { min-height: 84px; }
@media (max-width: 760px) {
  .calnav { grid-template-columns: 28px minmax(0, 1fr) 28px; gap: 2px; }
  .calarrow { font-size: 2rem; }
  .cal-semaine { grid-template-columns: 1fr; }
  .cal-semaine .calday.empty { display: none; }
  .calrow { gap: 3px; }
  .cal-mois .calday { min-height: 54px; padding: 4px; border-radius: 8px; }
  .cal-mois .calhead .dow { display: none; }
  .cal-mois .calev .c, .cal-mois .calev .n { display: none; }
  .cal-mois .calev { padding: 2px 4px; }
  .cal-mois .calev .t { font-size: .72rem; }
}

/* Fiche élève : lecture seule, puis mode modification */
.fiche .edit-only { display: none; }
.fiche.editing .edit-only { display: block; }
.fiche.editing form.edit-only.actions { display: flex; }
.fiche.editing .view-only { display: none; }

/* Pop-up fiche élève */
.modal { border: 0; border-radius: 16px; padding: 0; width: min(760px, 94vw); max-height: 90vh; background: var(--bg); color: var(--ink); box-shadow: 0 20px 60px rgba(0,0,0,.35); }
.modal::backdrop { background: rgba(63,58,69,.45); }
.modal-body { padding: 22px 22px 26px; overflow: auto; max-height: 90vh; }
.modal-body h1 { font-size: 1.5rem; }
.modal-close { position: absolute; top: 10px; right: 12px; width: 36px; height: 36px; border-radius: 50%; border: 0; background: var(--mauve-soft); color: var(--mauve-dark); font-size: 1.4rem; line-height: 1; cursor: pointer; }
.modal-close:hover { background: var(--mauve-line); }
@media (max-width: 600px) { .modal { width: 100vw; max-width: 100vw; height: 100vh; max-height: 100vh; border-radius: 0; margin: 0; } .modal-body { max-height: 100vh; } }

pre.log { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 12px; font-size: .8rem; max-height: 420px; overflow: auto; white-space: pre-wrap; }
.empty { text-align: center; color: var(--muted); padding: 30px 10px; }
