/* En mouvement vers Soi — application des cours de yoga */

@font-face { font-family: "Alegreya"; src: url("fonts/alegreya-latin-500-normal.woff2") format("woff2"); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: "Alegreya"; src: url("fonts/alegreya-latin-700-normal.woff2") format("woff2"); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: "Alegreya"; src: url("fonts/alegreya-latin-400-italic.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "Alegreya Sans"; src: url("fonts/alegreya-sans-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Alegreya Sans"; src: url("fonts/alegreya-sans-latin-500-normal.woff2") format("woff2"); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: "Alegreya Sans"; src: url("fonts/alegreya-sans-latin-700-normal.woff2") format("woff2"); font-weight: 700; font-style: normal; font-display: swap; }

:root {
  --paper: #FFFFFF;
  --mist: #F7F3F4;
  --ink: #2A2326;
  --ink-soft: #6E6266;
  --red: #C40A1C;
  --red-deep: #9C0716;
  --blush: #FBECEE;
  --line: #EBE3E5;
  --mat: #E4DADD;
  --moss: #3F6B55;
  --moss-tint: #EAF2ED;
  --amber-tint: #FBF3E4;
  --amber: #8A5A12;

  --serif: "Alegreya", Georgia, "Times New Roman", serif;
  --sans: "Alegreya Sans", "Segoe UI", system-ui, -apple-system, sans-serif;

  --r-s: 6px;
  --r-m: 14px;
  --gutter: 18px;
  --tabbar: 64px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; }
a { color: var(--red); text-underline-offset: 3px; }
a:hover { color: var(--red-deep); }
:focus-visible { outline: 3px solid var(--red); outline-offset: 2px; border-radius: 4px; }

h1, h2, h3 { font-family: var(--serif); font-weight: 500; line-height: 1.15; margin: 0; letter-spacing: -0.005em; }
h1 { font-size: 32px; }
h2 { font-size: 26px; }
h3 { font-size: 21px; }
p { margin: 0 0 12px; }
.muted { color: var(--ink-soft); }
.small { font-size: 15px; }
.nowrap { white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Structure ---------- */

.top {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px var(--gutter);
  padding-top: max(10px, env(safe-area-inset-top));
  background: rgba(255,255,255,.94);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); min-width: 0; }
.brand img { width: 38px; height: 38px; flex: none; }
.brand span { font-family: var(--serif); font-style: italic; font-size: 20px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me {
  width: 38px; height: 38px; flex: none; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--mist); color: var(--ink); text-decoration: none; font-weight: 700; font-size: 15px;
}
.me:hover { background: var(--blush); color: var(--ink); }

.wrap { max-width: 640px; margin: 0 auto; padding: 22px var(--gutter) calc(var(--tabbar) + 40px + env(safe-area-inset-bottom)); }
.wrap.wide { max-width: 1040px; }

.page-head { margin-bottom: 22px; }
.page-head h1 + p { margin-top: 6px; }

/* Barre d'onglets (mobile en bas, ordinateur en haut) */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: var(--paper); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabs a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  height: var(--tabbar); text-decoration: none; color: var(--ink-soft); font-size: 13.5px; font-weight: 500;
}
.tabs a svg { width: 24px; height: 24px; stroke: currentColor; fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.tabs a[aria-current="page"] { color: var(--red); }
.tabs .dot { position: relative; }
.tabs .dot::after { content: ""; position: absolute; top: -1px; right: -4px; width: 8px; height: 8px; border-radius: 50%; background: var(--red); }

@media (min-width: 860px) {
  .tabs { position: static; display: flex; justify-content: center; gap: 6px; border-top: 0; border-bottom: 1px solid var(--line); padding: 0; }
  .tabs a { flex-direction: row; height: 50px; padding: 0 16px; font-size: 16px; gap: 8px; }
  .tabs a svg { width: 20px; height: 20px; }
  .tabs a[aria-current="page"] { box-shadow: inset 0 -2px 0 var(--red); }
  .wrap { padding-bottom: 60px; }
}

/* ---------- Messages ---------- */

.flash { padding: 12px 16px; border-radius: var(--r-s); margin-bottom: 18px; background: var(--moss-tint); color: #23402F; }
.flash.error { background: var(--blush); color: var(--red-deep); }
.flash.info { background: var(--mist); color: var(--ink); }

/* ---------- Boutons et formulaires ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 10px 20px;
  border: 1.5px solid var(--red); border-radius: 999px;
  background: var(--red); color: #fff;
  font: 700 16px/1.2 var(--sans); text-decoration: none; cursor: pointer;
  transition: background-color .15s, color .15s, border-color .15s;
}
.btn:hover { background: var(--red-deep); border-color: var(--red-deep); color: #fff; }
.btn.ghost { background: transparent; color: var(--red); }
.btn.ghost:hover { background: var(--blush); color: var(--red-deep); }
.btn.quiet { background: transparent; color: var(--ink); border-color: var(--line); font-weight: 500; }
.btn.quiet:hover { background: var(--mist); color: var(--ink); }
.btn.moss { background: var(--moss); border-color: var(--moss); }
.btn.moss:hover { background: #2F5341; border-color: #2F5341; }
.btn.small { min-height: 36px; padding: 6px 14px; font-size: 15px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.linkish { background: none; border: 0; padding: 0; font: inherit; color: var(--red); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.inline { display: inline; }

label { display: block; font-weight: 500; margin-bottom: 6px; }
.field { margin-bottom: 18px; }
.field .hint { font-size: 14.5px; color: var(--ink-soft); margin-top: 4px; }
input[type=text], input[type=email], input[type=tel], input[type=number], input[type=date], input[type=time], input[type=datetime-local], select, textarea {
  width: 100%; min-height: 48px; padding: 10px 14px;
  border: 1.5px solid var(--line); border-radius: var(--r-s);
  background: #fff; color: var(--ink); font: 17px/1.4 var(--sans);
}
textarea { min-height: 110px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--ink-soft); box-shadow: 0 0 0 3px var(--blush); }
.code-input { font-size: 30px; letter-spacing: 10px; text-align: center; font-variant-numeric: tabular-nums; max-width: 260px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; cursor: pointer; }
.check input { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--red); flex: none; }
.row { display: grid; gap: 14px; grid-template-columns: 1fr 1fr; }
@media (max-width: 480px) { .row.stack-sm { grid-template-columns: 1fr; } }
.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 8px; }

/* ---------- Connexion ---------- */

.auth { max-width: 420px; margin: 0 auto; padding: 36px var(--gutter) 60px; }
.auth-logo { display: block; width: 150px; height: 150px; margin: 0 auto 14px; }
.auth h1 { text-align: center; font-size: 30px; }
.auth .lead { text-align: center; color: var(--ink-soft); margin: 8px 0 28px; }
.auth-foot { margin-top: 26px; text-align: center; font-size: 15.5px; color: var(--ink-soft); }

/* ---------- Résumé en tête de page d'accueil ---------- */

.glance { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--line); border-radius: var(--r-m); overflow: hidden; margin-bottom: 30px; }
.glance a { background: var(--mist); padding: 12px 12px 13px; text-decoration: none; color: var(--ink); display: block; }
.glance a:hover { background: var(--blush); color: var(--ink); }
.glance .k { display: block; font-size: 14px; color: var(--ink-soft); }
.glance .v { display: block; font-family: var(--serif); font-size: 19px; line-height: 1.2; margin-top: 2px; }
.glance .v.alert { color: var(--red); }

/* ---------- Liste des cours ---------- */

.month { margin: 0 0 30px; }
.month > h2 { font-size: 30px; margin-bottom: 4px; }
.month > h2 + .muted { margin-bottom: 10px; }

.course {
  display: grid; grid-template-columns: 1fr auto; gap: 4px 16px; align-items: center;
  padding: 16px 14px; margin: 0 -14px; border-radius: var(--r-m);
  scroll-margin-top: 80px;
}
.course + .course { border-top: 1px solid var(--line); border-top-left-radius: 0; border-top-right-radius: 0; }
.course.is-mine { background: var(--blush); border-top-color: transparent; border-radius: var(--r-m); }
.course.is-mine + .course { border-top-color: transparent; }
.course.is-cancelled .course-day, .course.is-cancelled .course-time { text-decoration: line-through; color: var(--ink-soft); }
.course:target { box-shadow: inset 0 0 0 2px var(--red); }

.course-when { grid-column: 1; display: flex; align-items: baseline; flex-wrap: wrap; gap: 0 12px; }
.course-day { font-family: var(--serif); font-size: 22px; font-weight: 500; }
.course-time { font-family: var(--serif); font-size: 22px; font-weight: 700; font-variant-numeric: lining-nums; }
.course-info { grid-column: 1 / -1; margin: 0; color: var(--ink-soft); font-style: italic; font-family: var(--serif); font-size: 17.5px; }
.course-meta { grid-column: 1; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 15.5px; }
.course-action { grid-column: 2; grid-row: 1 / span 3; align-self: center; text-align: right; }
.course-action form { margin: 0; }
.course-note { grid-column: 1 / -1; font-size: 15px; color: var(--ink-soft); margin: 4px 0 0; }
.course-note.priority { color: var(--amber); }
@media (max-width: 520px) {
  .course { grid-template-columns: 1fr; }
  .course-action { grid-column: 1; grid-row: auto; text-align: left; margin-top: 8px; }
  .course-action .btn { width: 100%; }
}

/* Les tapis : un par place, plein = libre */
.mats { display: inline-flex; gap: 4px; align-items: center; }
.mats i { display: block; width: 9px; height: 20px; border-radius: 3px; background: var(--mat); }
.mats i.free { background: var(--red); }
.mats i.you { background: var(--ink); }
.is-cancelled .mats i { background: var(--mat); }
.places { color: var(--ink); font-weight: 500; }
.places.full { color: var(--ink-soft); }
.state { font-weight: 700; color: var(--ink); }
.state.ok::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--moss); margin-right: 7px; vertical-align: 2px; }

.empty { padding: 28px 20px; background: var(--mist); border-radius: var(--r-m); text-align: center; color: var(--ink-soft); }
.empty h2, .empty h3 { color: var(--ink); margin-bottom: 6px; }

/* ---------- Sections et listes ---------- */

.section { margin: 0 0 34px; }
.section > h2 { margin-bottom: 12px; }
.section > h2 .count { font-family: var(--sans); font-size: 16px; color: var(--ink-soft); font-weight: 500; margin-left: 6px; }

.list { list-style: none; margin: 0; padding: 0; }
.list > li { padding: 14px 0; border-top: 1px solid var(--line); display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.list > li:last-child { border-bottom: 1px solid var(--line); }
.list .main { min-width: 0; flex: 1 1 220px; }
.list .title { font-family: var(--serif); font-size: 19px; }
.list .sub { font-size: 15px; color: var(--ink-soft); }
.list .side { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.tag { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 13.5px; font-weight: 500; background: var(--mist); color: var(--ink-soft); white-space: nowrap; }
.tag.regular { background: var(--blush); color: var(--red-deep); }
.tag.ok { background: var(--moss-tint); color: #23402F; }
.tag.warn { background: var(--amber-tint); color: var(--amber); }
.tag.bad { background: var(--blush); color: var(--red-deep); }

/* ---------- Carte de cours ---------- */

.punch { background: var(--mist); border-radius: var(--r-m); padding: 20px; margin-bottom: 14px; }
.punch .big { font-family: var(--serif); font-size: 40px; line-height: 1; }
.punch .big small { font-size: 20px; }
.punch .holes { display: flex; gap: 8px; margin: 14px 0 10px; flex-wrap: wrap; }
.punch .holes i { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--red); background: var(--red); }
.punch .holes i.used { background: transparent; border-color: var(--mat); }
.punch.expired { opacity: .6; }

.pay-box { border: 1.5px solid var(--line); border-radius: var(--r-m); padding: 20px; text-align: center; margin-bottom: 18px; }
.pay-box .amount { font-family: var(--serif); font-size: 38px; }
.pay-box img.qr { width: 230px; height: 230px; object-fit: contain; margin: 10px auto; display: block; border-radius: 8px; }
.pay-box .ref { background: var(--mist); border-radius: var(--r-s); padding: 8px 12px; display: inline-block; font-weight: 700; }

.history { font-size: 15.5px; }
.history li { padding: 10px 0; }
.history .amt { font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--ink-soft); }

/* ---------- Actualités ---------- */

.news-item { padding: 20px 0; border-top: 1px solid var(--line); }
.news-item:first-child { border-top: 0; padding-top: 0; }
.news-item h2 { font-size: 24px; margin-bottom: 4px; }
.news-item .date { font-size: 14.5px; color: var(--ink-soft); margin-bottom: 10px; }
.news-item .body p { font-family: var(--serif); font-size: 18.5px; line-height: 1.6; }

/* ---------- Divers ---------- */

details.reveal { margin-top: 10px; }
details.reveal > summary { cursor: pointer; color: var(--red); list-style: none; display: inline-block; }
details.reveal > summary::-webkit-details-marker { display: none; }
details.reveal[open] > summary { margin-bottom: 10px; }
.panel { background: var(--mist); border-radius: var(--r-m); padding: 16px; }
.hr { border: 0; border-top: 1px solid var(--line); margin: 26px 0; }
.install-hint { background: var(--mist); border-radius: var(--r-m); padding: 14px 16px; font-size: 15.5px; margin-bottom: 18px; }
.install-hint[hidden] { display: none; }

/* ---------- Administration ---------- */

.admin-nav { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; border-bottom: 1px solid var(--line); background: var(--paper); padding: 0 calc(var(--gutter) - 10px); position: sticky; top: 59px; z-index: 15; }
.admin-nav::-webkit-scrollbar { display: none; }
.admin-nav a { flex: none; padding: 13px 12px; text-decoration: none; color: var(--ink-soft); font-weight: 500; white-space: nowrap; }
.admin-nav a[aria-current="page"] { color: var(--red); box-shadow: inset 0 -2px 0 var(--red); }
.admin-nav .badge { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--red); color: #fff; font-size: 12.5px; font-weight: 700; margin-left: 4px; }
@media (min-width: 860px) { .admin-nav { justify-content: center; } }

.todo { display: grid; gap: 14px; }
@media (min-width: 860px) { .todo { grid-template-columns: 1fr 1fr; } }
.todo-box { border: 1.5px solid var(--line); border-radius: var(--r-m); padding: 16px 18px; }
.todo-box h2 { font-size: 22px; margin-bottom: 8px; }
.todo-box.hot { border-color: var(--red); }
.todo-box .list > li:first-child { border-top: 0; }
.todo-box .list > li:last-child { border-bottom: 0; }

table.grid { width: 100%; border-collapse: collapse; font-size: 16px; }
table.grid th { text-align: left; font-weight: 500; color: var(--ink-soft); font-size: 14.5px; padding: 8px 10px 8px 0; border-bottom: 1px solid var(--line); }
table.grid td { padding: 11px 10px 11px 0; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table-scroll { overflow-x: auto; }

.seg { display: inline-flex; border: 1.5px solid var(--line); border-radius: 999px; overflow: hidden; }
.seg label { margin: 0; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: block; padding: 7px 14px; font-weight: 500; font-size: 15px; cursor: pointer; color: var(--ink-soft); }
.seg input:checked + span { background: var(--ink); color: #fff; }
.seg input:focus-visible + span { outline: 3px solid var(--red); outline-offset: -3px; }

.attend { list-style: none; margin: 0; padding: 0; }
.attend li { display: grid; grid-template-columns: 1fr auto; gap: 8px 14px; align-items: center; padding: 14px 0; border-top: 1px solid var(--line); }
.attend .who { font-family: var(--serif); font-size: 19px; }
.attend .opts { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
@media (max-width: 560px) { .attend li { grid-template-columns: 1fr; } .attend .opts { justify-content: flex-start; } }

.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.filters a { padding: 7px 14px; border-radius: 999px; background: var(--mist); color: var(--ink); text-decoration: none; font-size: 15.5px; }
.filters a[aria-current="page"] { background: var(--ink); color: #fff; }

.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; }
.kv dt { color: var(--ink-soft); }
.kv dd { margin: 0; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }

/* Tutoriel d'installation (écran de connexion) */
.install { margin-top: 34px; padding: 20px 18px 8px; background: var(--mist); border-radius: var(--r-m); }
.install h2 { margin: 0; font-family: var(--serif); font-weight: 700; font-size: 21px; line-height: 1.25; text-align: center; }
.install-lead, .install-desk { margin: 8px 0 16px; text-align: center; font-size: 15.5px; color: var(--ink-soft); }
.install-desk { margin-top: -6px; }
.install #install-now { margin-bottom: 16px; }
.install-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; background: #fff; border: 1px solid var(--line); border-radius: 999px; margin-bottom: 6px; }
.install-tabs button { appearance: none; border: 0; border-radius: 999px; background: transparent; padding: 9px 10px; font: 500 15.5px/1.2 var(--sans); color: var(--ink-soft); cursor: pointer; }
.install-tabs button[aria-selected="true"] { background: var(--red); color: #fff; }
.install-tabs button:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }
.install-steps { list-style: none; margin: 0; padding: 0; counter-reset: step; }
.install-steps li { counter-increment: step; display: grid; grid-template-columns: 44px 1fr; gap: 12px; align-items: center; padding: 12px 0; border-top: 1px solid var(--line); font-size: 15.5px; line-height: 1.45; }
.install-steps li:first-child { border-top: 0; }
.install-ico { position: relative; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; background: #fff; color: var(--red); border: 1px solid var(--line); }
.install-ico::after { content: counter(step); position: absolute; top: -6px; left: -6px; width: 19px; height: 19px; border-radius: 50%; background: var(--red); color: #fff; font: 700 11.5px/19px var(--sans); text-align: center; }
.install-app { background: transparent; border: 0; }
.install-app img { width: 40px; height: 40px; border-radius: 10px; box-shadow: 0 2px 6px rgba(42, 35, 38, .18); }
.install [hidden] { display: none !important; }
