@font-face {
  font-family: "Anton";
  src: url("/fonts/anton.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "DM Sans";
  src: url("/fonts/dm-sans.woff2") format("woff2");
  font-weight: 100 1000;
  font-display: swap;
}

:root {
  --bg: #131417;
  --surface: #1D1F24;
  --raised: #262930;
  --line: #30343C;
  --text: #F2F1EC;
  --muted: #A7AAAF;
  --accent: #C6F24E;
  --on-accent: #131417;
  --danger: #FF8A7A;
  --radius-s: 10px;
  --radius-m: 14px;
  --radius-l: 22px;
  --display: "Anton", Impact, "Arial Narrow Bold", sans-serif;
  --body: "DM Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.5;
}
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Mise en page ---------- */
#app {
  max-width: 480px;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top, 0px) + 24px) 20px calc(env(safe-area-inset-bottom, 0px) + 104px);
}
.stack { display: flex; flex-direction: column; gap: 16px; }
.stack-s { display: flex; flex-direction: column; gap: 8px; }
.row { display: flex; align-items: center; gap: 12px; }
.row-wrap { display: flex; flex-wrap: wrap; gap: 8px; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.section { margin-top: 32px; }

/* ---------- Typographie ---------- */
h1, h2, .brand {
  font-family: var(--display);
  font-weight: 400;
  line-height: 1.02;
  margin: 0;
}
h1 { font-size: 40px; }
h2 { font-size: 26px; }
h3 { font-size: 17px; font-weight: 700; margin: 0; }
.brand { font-size: 56px; color: var(--accent); }
.brand-s { font-size: 28px; }
.lead { font-size: 18px; color: var(--text); margin: 0; max-width: 32ch; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
p { margin: 0; }

/* ---------- Boutons ---------- */
.btn {
  min-height: 48px;
  padding: 0 20px;
  border-radius: var(--radius-m);
  border: 1px solid var(--line);
  background: var(--surface);
  font-weight: 700;
  font-size: 16px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
}
.btn:hover { background: var(--raised); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover { filter: brightness(1.05); }
.btn.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, var(--line)); }
.btn.link { background: none; border: 0; color: var(--muted); font-weight: 500; text-decoration: underline; text-underline-offset: 3px; }
.btn.link:hover { color: var(--text); }
.btn.small { min-height: 40px; padding: 0 14px; font-size: 14px; }
.btn[disabled] { opacity: .55; cursor: wait; }
.btn.block { width: 100%; }

/* Pastilles de choix */
.chip {
  min-height: 44px;
  padding: 0 16px;
  border-radius: var(--radius-s);
  border: 1px solid var(--line);
  background: var(--surface);
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
}
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.chip-grid { display: grid; gap: 8px; }
.chip-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.chip-grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.chip-grid .chip { padding: 0 6px; }

/* Jours : défilement horizontal */
.days { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.days::-webkit-scrollbar { display: none; }
.day {
  flex: 0 0 56px;
  height: 66px;
  border-radius: var(--radius-s);
  border: 1px solid var(--line);
  background: var(--surface);
  cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.day small { font-size: 12px; color: var(--muted); font-weight: 600; }
.day strong { font-size: 19px; }
.day[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.day[aria-pressed="true"] small { color: var(--on-accent); }

/* ---------- Formulaires ---------- */
label.field { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 600; color: var(--muted); }
.field-label { font-size: 14px; font-weight: 600; color: var(--muted); }
input, select, textarea {
  min-height: 50px;
  width: 100%;
  border-radius: var(--radius-m);
  border: 1px solid var(--line);
  background: var(--surface);
  padding: 12px 14px;
  font-size: 16px;
}
textarea { resize: vertical; min-height: 90px; }
input::placeholder, textarea::placeholder { color: #7D8086; }
.hint { font-size: 14px; color: var(--muted); }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ---------- Blocs ---------- */
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-l);
  padding: 18px;
}
.hero {
  background: var(--accent);
  color: var(--on-accent);
  border-radius: var(--radius-l);
  padding: 22px;
  display: flex; flex-direction: column; gap: 12px;
}
.hero h2 { font-size: 32px; }
.hero .btn { align-self: flex-start; background: var(--on-accent); color: var(--text); border-color: var(--on-accent); }

.slot {
  display: grid;
  grid-template-columns: 58px 1fr;
  gap: 14px;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-l);
}
.slot-date {
  background: var(--bg);
  border-radius: var(--radius-m);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  height: 64px;
}
.slot-date small { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: capitalize; }
.slot-date strong { font-family: var(--display); font-size: 24px; font-weight: 400; line-height: 1; }
.slot-status { font-size: 14px; color: var(--muted); }
.slot-status.ok { color: var(--accent); }
.slot-actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }

.person { display: flex; align-items: center; gap: 14px; }
.avatar {
  width: 48px; height: 48px; flex: 0 0 48px;
  border-radius: 50%;
  background: var(--raised);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
}
.person-info { flex: 1; min-width: 0; }
.section-s { margin-top: 12px; }
summary { cursor: pointer; font-weight: 600; min-height: 32px; }
.gym-result { text-align: left; justify-content: flex-start; width: 100%; font-weight: 500; }

.empty { text-align: left; padding: 28px 20px; }

.privacy { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; color: #C9CACC; }
.privacy svg { flex: 0 0 18px; margin-top: 2px; stroke: var(--accent); fill: none; stroke-width: 2; }

/* ---------- Chat ---------- */
.chat { display: flex; flex-direction: column; gap: 12px; }
.messages { display: flex; flex-direction: column; gap: 10px; min-height: 120px; }
.bubble-wrap { display: flex; flex-direction: column; gap: 2px; align-items: flex-start; }
.bubble-wrap.mine { align-items: flex-end; }
.bubble-author { font-size: 12px; color: var(--muted); }
.bubble {
  max-width: 80%;
  padding: 10px 14px;
  border-radius: 16px 16px 16px 4px;
  background: var(--surface);
  border: 1px solid var(--line);
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}
.mine .bubble { background: var(--accent); border-color: var(--accent); color: var(--on-accent); border-radius: 16px 16px 4px 16px; }
.composer { display: flex; gap: 8px; position: sticky; bottom: calc(env(safe-area-inset-bottom, 0px) + 84px); background: var(--bg); padding-top: 8px; }
.composer input { flex: 1; }

/* ---------- Navigation ---------- */
.nav {
  position: fixed; left: 0; right: 0; bottom: 0;
  display: flex; justify-content: center; gap: 8px;
  padding: 8px 12px calc(env(safe-area-inset-bottom, 0px) + 8px);
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
  z-index: 10;
}
.nav[hidden] { display: none; }
.nav a {
  flex: 0 1 140px;
  min-height: 56px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  text-decoration: none;
  font-size: 12px; font-weight: 600;
  color: var(--muted);
  border-radius: var(--radius-m);
}
.nav a[aria-current="page"] { color: var(--accent); }
.nav svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Toast et dialogue ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom, 0px) + 96px);
  transform: translate(-50%, 16px);
  max-width: min(440px, calc(100vw - 32px));
  padding: 12px 18px;
  border-radius: var(--radius-m);
  background: var(--text); color: var(--bg);
  font-weight: 600;
  opacity: 0; pointer-events: none;
  transition: opacity .2s, transform .2s;
  z-index: 30;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: var(--danger); color: #1a0d0b; }

.dialog {
  width: min(440px, calc(100vw - 32px));
  border: 1px solid var(--line);
  border-radius: var(--radius-l);
  background: var(--surface);
  color: var(--text);
  padding: 22px;
}
.dialog::backdrop { background: rgb(0 0 0 / .6); }
.dialog hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; width: 100%; }

.loading { color: var(--muted); padding: 40px 0; }

@media (prefers-reduced-motion: reduce) {
  .toast { transition: none; }
}

.btn.back { align-self: flex-start; padding-left: 0; min-height: 40px; }
