:root {
  /* L'application est en clair uniquement : fond blanc, accents orange.
     Aucun thème sombre — un appareil réglé en sombre voit la même page. */
  color-scheme: light;

  /* fond et surfaces */
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-2: #fdf4e9;
  --line: #f1e7da;

  /* texte */
  --ink: #2f3b52;
  --ink-soft: #8b94a7;

  /* orange : couleur d'action */
  --orange: #f7941e;
  --orange-strong: #ef7b16;
  --orange-soft: #fdeeda;

  /* jaune : couleur d'attente et d'accent */
  --yellow: #f5b820;
  --yellow-soft: #fdf3d6;
  --sun-1: #ffd451;
  --sun-2: #f9a12c;

  /* rouge : annulation seulement */
  --red: #e2674f;
  --red-soft: #fce6e0;

  --radius: 20px;
  --shadow: 0 2px 4px rgba(47, 59, 82, .05), 0 10px 26px rgba(47, 59, 82, .08);
  --shadow-soft: 0 1px 3px rgba(47, 59, 82, .06);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  padding-bottom: 3rem;
}

main { max-width: 720px; margin: 0 auto; padding: 0 16px; }

/* ------------------------------------------------------------- en-tête */

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 16px 14px;
  background: linear-gradient(120deg, var(--sun-1) 0%, var(--sun-2) 100%);
  border-bottom: none;
  box-shadow: var(--shadow-soft);
}

.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand__logo {
  width: 40px; height: 40px; border-radius: 12px; object-fit: contain; flex: none;
  background: rgba(255, 255, 255, .9); padding: 2px;
}
.brand__text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.brand__app { font-weight: 800; letter-spacing: -.015em; color: #fff; font-size: 1.05rem; }
.brand__club {
  font-size: .8rem; color: rgba(255, 255, 255, .92); white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}

.whoami {
  flex: none; border: none; background: #fff; color: var(--orange-strong);
  border-radius: 999px; padding: 8px 15px; font: inherit; font-size: .85rem;
  font-weight: 700; cursor: pointer; max-width: 45vw; box-shadow: var(--shadow-soft);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* --------------------------------------------------------------- onglets */

.tabs {
  display: flex; gap: 4px; max-width: 720px; margin: 0 auto;
  padding: 14px 16px 0; overflow-x: auto;
}
.tab {
  border: none; background: none; color: var(--ink-soft);
  font: inherit; font-weight: 700; font-size: .92rem;
  padding: 9px 14px; border-radius: 999px; cursor: pointer; white-space: nowrap;
}
.tab--on { background: var(--orange); color: #fff; box-shadow: var(--shadow-soft); }

.view { padding-top: 14px; }

/* ---------------------------------------------------------------- cartes */

.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 18px; margin-bottom: 16px;
}
.card--off { opacity: .75; }
.card--cancel { box-shadow: var(--shadow), inset 0 0 0 1.5px var(--red); }

.card__date {
  font-size: .78rem; font-weight: 800; text-transform: uppercase;
  letter-spacing: .06em; color: var(--orange);
}
.card__title { margin: 5px 0 2px; font-size: 1.2rem; line-height: 1.25; font-weight: 800; }
.card__title--empty { color: var(--ink-soft); font-weight: 600; font-style: italic; }
.card__meta { color: var(--ink-soft); font-size: .87rem; margin: 0 0 12px; }
.card__desc { margin: 0 0 14px; white-space: pre-wrap; }

.banner {
  border-radius: 12px; padding: 10px 13px; margin: 0 0 12px;
  font-size: .9rem; font-weight: 700;
}
.banner--red { background: var(--red-soft); color: var(--red); }
.banner--amber { background: var(--yellow-soft); color: #a9791a; }
.banner--green { background: var(--orange-soft); color: var(--orange-strong); }

/* ----------------------------------------------------------------- jauge */

.gauge { margin: 0 0 14px; }
.gauge__label {
  display: flex; justify-content: space-between; font-size: .85rem;
  color: var(--ink-soft); margin-bottom: 6px; gap: 8px; font-weight: 600;
}
.gauge__track { height: 8px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.gauge__fill {
  height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, var(--sun-1), var(--orange));
}
.gauge__fill--full { background: linear-gradient(90deg, var(--orange), var(--orange-strong)); }

/* --------------------------------------------------------------- réponses */

.answers { display: flex; gap: 8px; margin-bottom: 16px; }
.answer {
  flex: 1; border: 1.5px solid var(--line); background: var(--surface);
  color: var(--ink-soft); border-radius: 14px; padding: 12px 6px;
  font: inherit; font-weight: 700; font-size: .88rem; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
}
.answer:disabled { cursor: not-allowed; opacity: .45; }
.answer__icon { font-size: 1.1rem; line-height: 1; }

.answer--yes.answer--on {
  border-color: transparent; color: #fff;
  background: linear-gradient(120deg, var(--sun-2), var(--orange-strong));
  box-shadow: 0 6px 14px rgba(239, 123, 22, .28);
}
.answer--maybe.answer--on {
  border-color: var(--yellow); background: var(--yellow-soft); color: #a9791a;
}
.answer--no.answer--on {
  border-color: var(--ink-soft); background: var(--surface-2); color: var(--ink);
}

/* ----------------------------------------------------------------- listes */

.group { margin-bottom: 12px; }
.group__head {
  font-size: .82rem; font-weight: 800; color: var(--ink-soft); margin-bottom: 7px;
  text-transform: uppercase; letter-spacing: .04em;
}
.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chip {
  background: var(--surface-2); color: var(--ink); border-radius: 999px;
  padding: 5px 13px; font-size: .86rem; font-weight: 600; border: 1.5px solid transparent;
}
.chip--me { border-color: var(--orange); color: var(--orange-strong); font-weight: 800; }
.chip--wait { background: var(--yellow-soft); color: #a9791a; }
.chip__pos { font-size: .74rem; opacity: .75; }

details.more { margin-top: 8px; }
details.more > summary {
  cursor: pointer; font-size: .86rem; color: var(--orange-strong); font-weight: 700;
  list-style: none; padding: 5px 0;
}
details.more > summary::-webkit-details-marker { display: none; }
details.more > summary::before { content: "▸ "; }
details.more[open] > summary::before { content: "▾ "; }

/* ------------------------------------------------------------------ jeux */

.games { border-top: 1.5px dashed var(--line); margin-top: 16px; padding-top: 14px; }
.game {
  display: flex; align-items: baseline; gap: 8px; padding: 7px 0;
  border-bottom: 1px solid var(--surface-2); font-size: .92rem;
}
.game:last-of-type { border-bottom: none; }
.game__name { font-weight: 700; }
.game__meta { color: var(--ink-soft); font-size: .81rem; }
.game__who { color: var(--ink-soft); font-size: .81rem; margin-left: auto; white-space: nowrap; }
.game__del {
  border: none; background: none; color: var(--red); cursor: pointer;
  font-size: 1rem; padding: 0 2px; line-height: 1;
}

/* --------------------------------------------------------------- formulaires */

.field { display: block; margin-bottom: 13px; }
.field > span {
  display: block; font-size: .82rem; font-weight: 700;
  color: var(--ink-soft); margin-bottom: 5px;
}
input, select, textarea {
  width: 100%; font: inherit; color: var(--ink);
  background: var(--surface-2); border: 1.5px solid transparent;
  border-radius: 12px; padding: 11px 13px;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--orange); background: var(--surface);
}
textarea { min-height: 78px; resize: vertical; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; min-width: 0; }

.btn {
  border: 1.5px solid var(--line); background: var(--surface); color: var(--ink);
  border-radius: 12px; padding: 11px 16px; font: inherit; font-weight: 700;
  cursor: pointer;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn--primary {
  border-color: transparent; color: #fff;
  background: linear-gradient(120deg, var(--sun-2), var(--orange-strong));
  box-shadow: 0 6px 14px rgba(239, 123, 22, .25);
}
.btn--danger { color: var(--red); border-color: var(--red); background: var(--surface); }
.btn--ghost { background: none; }
.btn--small { padding: 8px 13px; font-size: .85rem; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }

/* ------------------------------------------------------------------ divers */

.flash {
  position: sticky; top: 66px; z-index: 15;
  border-radius: 12px; padding: 11px 14px; margin: 12px 0;
  font-size: .9rem; font-weight: 700;
  background: var(--red-soft); color: var(--red);
  box-shadow: var(--shadow-soft);
}
.flash--ok { background: var(--orange-soft); color: var(--orange-strong); }

.muted { color: var(--ink-soft); font-size: .88rem; }
.error { color: var(--red); font-size: .86rem; font-weight: 700; }
.sep { text-align: center; color: var(--ink-soft); font-size: .82rem; margin: 4px 0; }
h2 { font-size: 1.08rem; font-weight: 800; margin: 24px 0 11px; }
h2:first-child { margin-top: 4px; }

.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 16px; }
.stat {
  background: linear-gradient(150deg, var(--yellow-soft), var(--orange-soft));
  border-radius: 16px; padding: 13px 10px; text-align: center;
}
.stat__num { font-size: 1.4rem; font-weight: 800; display: block; color: var(--orange-strong); }
.stat__lbl { font-size: .73rem; color: var(--ink-soft); font-weight: 600; }

.bars { display: flex; flex-direction: column; gap: 6px; }
.bar { display: flex; align-items: center; gap: 8px; font-size: .84rem; }
.bar__lbl {
  width: 40%; color: var(--ink-soft); overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; font-weight: 600;
}
.bar__track {
  display: block; flex: 1; height: 10px; background: var(--surface-2);
  border-radius: 999px; overflow: hidden;
}
.bar__fill {
  display: block; height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, var(--sun-1), var(--orange));
}
.bar__num { width: 2.2rem; text-align: right; font-variant-numeric: tabular-nums; font-weight: 700; }

.mlist { list-style: none; padding: 0; margin: 0; }
.mlist li {
  display: flex; align-items: center; gap: 8px; padding: 9px 0;
  border-bottom: 1px solid var(--surface-2);
}
.mlist li:last-child { border-bottom: none; }
.mlist__name { flex: 1; font-weight: 600; }
.mlist__name--off { color: var(--ink-soft); text-decoration: line-through; font-weight: 500; }

/* --------------------------------------------------------------- dialogue */

.sheet {
  border: none; border-radius: 22px; padding: 0; width: min(440px, calc(100vw - 32px));
  background: var(--surface); color: var(--ink); box-shadow: var(--shadow);
}
.sheet::backdrop { background: rgba(47, 59, 82, .45); }
.sheet__body { padding: 22px; }
.sheet__body h2 { margin-top: 0; }
.sheet__actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 18px; }

.foot {
  max-width: 720px; margin: 28px auto 0; padding: 20px 16px;
  border-top: 1.5px solid var(--line);
  display: flex; align-items: center; gap: 12px;
  color: var(--ink-soft); font-size: .82rem;
}
.foot__logo { width: 32px; height: 32px; border-radius: 10px; object-fit: contain; flex: none; }
.foot p { margin: 0; }

/* =========================================================== barre d'outils */

.toolbar { display: flex; justify-content: center; margin-bottom: 12px; }

.segmented {
  display: inline-flex; gap: 3px; padding: 3px;
  background: var(--surface-2); border-radius: 999px;
}
.seg {
  border: none; background: none; color: var(--ink-soft);
  font: inherit; font-weight: 700; font-size: .88rem;
  padding: 8px 20px; border-radius: 999px; cursor: pointer;
}
.seg--on { background: #fff; color: var(--orange-strong); box-shadow: var(--shadow-soft); }

/* --------------------------------------------------- étiquettes de thème */

.tfilter {
  display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 14px;
  justify-content: center;
}

.tlabel {
  display: inline-block; border: 1.5px solid transparent; border-radius: 999px;
  padding: 5px 13px; font: inherit; font-size: .82rem; font-weight: 700;
  cursor: default; max-width: 100%; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
}
button.tlabel { cursor: pointer; }
.tlabel--s { font-size: .74rem; padding: 3px 9px; }
.tlabel--on { border-color: currentColor; }
.tlabel--all { background: var(--surface-2); color: var(--ink-soft); }

.tlabel--0 { background: #ffe3cc; color: #b9590a; }
.tlabel--1 { background: #fff2c4; color: #8f6a00; }
.tlabel--2 { background: #dcf1e5; color: #16764c; }
.tlabel--3 { background: #d9e9fb; color: #15629f; }
.tlabel--4 { background: #e9e0fb; color: #6440ac; }
.tlabel--5 { background: #fbdce6; color: #ab3760; }
.tlabel--6 { background: #d8f1f3; color: #0d6e79; }
.tlabel--7 { background: #ebe4d8; color: #756445; }

.card__theme { margin: 2px 0 10px; }

/* --------------------------------------------------------------- calendrier */

.cal {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 14px; margin-bottom: 16px;
}

.cal__nav {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin-bottom: 12px;
}
.cal__nav .btn { padding: 6px 14px; font-size: 1.1rem; line-height: 1; }
.cal__month {
  font-weight: 800; font-size: 1rem; text-transform: capitalize;
  text-align: center; flex: 1;
}

.cal__head, .cal__grid {
  display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px;
}
.cal__head {
  margin-bottom: 6px; font-size: .72rem; font-weight: 800;
  color: var(--ink-soft); text-align: center;
}

.cal__cell {
  display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 0;
  min-height: 58px; padding: 5px 2px;
  border: 1.5px solid transparent; border-radius: 12px;
  background: none; font: inherit; color: var(--ink); cursor: default;
}
.cal__cell--out { color: var(--ink-soft); opacity: .45; }
.cal__cell--event { cursor: pointer; background: var(--surface-2); }
.cal__cell--today .cal__day {
  background: var(--orange); color: #fff; border-radius: 999px;
  width: 22px; height: 22px; display: grid; place-items: center;
}
.cal__cell--on { border-color: var(--orange); }
.cal__cell:disabled { cursor: default; }

.cal__day { font-size: .82rem; font-weight: 700; line-height: 22px; }

.cal__label {
  display: block; width: 100%; height: 6px; border-radius: 999px;
  font-size: 0; line-height: 0; overflow: hidden;
}

/* à partir d'une tablette, la case est assez large pour porter le texte */
@media (min-width: 560px) {
  .cal__label {
    height: auto; border-radius: 6px; padding: 2px 4px;
    font-size: .62rem; font-weight: 700; line-height: 1.3;
    text-overflow: ellipsis; white-space: nowrap;
  }
}
.cal__label--plain { background: var(--orange-soft); color: var(--orange-strong); }
.cal__label--off { background: var(--red); color: #fff; }

/* pastille de couleur rappelant le thème sur la ligne de date */
.tdot {
  display: inline-block; width: 9px; height: 9px; border-radius: 50%;
  margin-right: 7px; vertical-align: 1px;
}
.tdot--0 { background: #ef8321; }
.tdot--1 { background: #d9a400; }
.tdot--2 { background: #1f9c68; }
.tdot--3 { background: #2f83c8; }
.tdot--4 { background: #8460cf; }
.tdot--5 { background: #d1557f; }
.tdot--6 { background: #17909d; }
.tdot--7 { background: #9b8763; }
