/* ─── Lac du Poisson Blanc — thème solarpunk ─────────────────────────── */
:root {
  --moss:      #3a6b4f;
  --moss-deep: #2b5240;
  --leaf:      #6fae6b;
  --leaf-soft: #a9d6a0;
  --sun:       #f2c14e;
  --sun-deep:  #e8a33d;
  --terra:     #d98352;
  --bark:      #5c4433;
  --cream:     #f6f1e3;
  --paper:     #fffdf6;
  --water:     #8ecae6;
  --water-deep:#5fa8c9;
  --ink:       #2e3a30;
  --ink-soft:  #5d6b5c;
  --line:      #e3dcc6;
  --shadow:    0 8px 24px rgba(58, 107, 79, 0.12);
  --shadow-sm: 0 3px 10px rgba(58, 107, 79, 0.10);
  --radius:    18px;
  --radius-sm: 12px;
  --font-body: "Avenir Next", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-head: "Iowan Old Style", "Palatino Linotype", "Georgia", serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--ink);
  background:
    radial-gradient(circle at 12% -5%, rgba(242, 193, 78, 0.30), transparent 45%),
    radial-gradient(circle at 90% 8%, rgba(142, 202, 230, 0.30), transparent 40%),
    linear-gradient(160deg, #eef6e6 0%, var(--cream) 45%, #f3ead5 100%);
  background-attachment: fixed;
  min-height: 100vh;
  line-height: 1.5;
}

h1, h2, h3 { font-family: var(--font-head); font-weight: 600; color: var(--moss-deep); }
a { color: var(--moss); }

/* ─── Login ─────────────────────────────────────────────────────────── */
.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.login-card {
  background: var(--paper);
  border-radius: 28px;
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
  width: min(420px, 100%);
  padding: 40px 36px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.login-card::before {
  content: "";
  position: absolute; inset: 0 0 auto 0; height: 8px;
  background: linear-gradient(90deg, var(--leaf), var(--sun), var(--water));
}
.login-card .emblem { font-size: 52px; line-height: 1; margin-bottom: 6px; }
.login-card h1 { margin: 8px 0 2px; font-size: 1.6rem; }
.login-card .sub { color: var(--ink-soft); margin: 0 0 24px; font-size: 0.95rem; }
.field { text-align: left; margin-bottom: 16px; }
.field label { display: block; font-size: 0.82rem; font-weight: 600; color: var(--moss); margin-bottom: 6px; }
input[type=text], input[type=password], input[type=search], select, textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  font: inherit;
  background: #fff;
  color: var(--ink);
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--leaf);
  box-shadow: 0 0 0 3px rgba(111, 174, 107, 0.22);
}
.alert {
  background: #fdece0; color: #a14a2a; border: 1px solid #f1c7ac;
  border-radius: var(--radius-sm); padding: 10px 14px; font-size: 0.88rem; margin-bottom: 16px;
}

/* ─── Boutons ───────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 7px; justify-content: center;
  border: none; cursor: pointer; font: inherit; font-weight: 600;
  padding: 11px 18px; border-radius: 999px;
  background: var(--moss); color: #fff;
  box-shadow: var(--shadow-sm);
  transition: transform .12s, background .15s, box-shadow .15s;
}
.btn:hover { background: var(--moss-deep); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn.full { width: 100%; }
.btn.sun { background: var(--sun-deep); color: #4a3411; }
.btn.sun:hover { background: var(--sun); }
.btn.ghost { background: transparent; color: var(--moss); box-shadow: none; border: 1.5px solid var(--leaf-soft); }
.btn.ghost:hover { background: rgba(111,174,107,.12); }
.btn.small { padding: 6px 13px; font-size: 0.85rem; }
.btn.danger { background: transparent; color: var(--terra); box-shadow: none; padding: 6px 9px; }
.btn.danger:hover { background: rgba(217,131,82,.14); }

/* ─── Layout app ────────────────────────────────────────────────────── */
.topbar {
  display: flex; align-items: center; gap: 14px;
  padding: 16px clamp(16px, 4vw, 40px);
  background: rgba(255,253,246,.82);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
.topbar .brand { display: flex; align-items: center; gap: 10px; }
.topbar .brand .logo { font-size: 28px; }
.topbar .brand b { font-family: var(--font-head); font-size: 1.15rem; color: var(--moss-deep); }
.topbar .brand small { display: block; color: var(--ink-soft); font-size: 0.72rem; letter-spacing: .04em; }
.topbar .spacer { flex: 1; }
.topbar .who { color: var(--ink-soft); font-size: 0.85rem; }

main { max-width: 980px; margin: 0 auto; padding: clamp(16px, 4vw, 32px); }

/* ─── Onglets ───────────────────────────────────────────────────────── */
.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 22px; }
.tab {
  border: 1.5px solid transparent; background: rgba(255,255,255,.6);
  padding: 9px 16px; border-radius: 999px; cursor: pointer;
  font: inherit; font-weight: 600; color: var(--ink-soft);
  display: inline-flex; align-items: center; gap: 7px;
  transition: all .15s;
}
.tab:hover { color: var(--moss); border-color: var(--leaf-soft); }
.tab.active { background: var(--moss); color: #fff; box-shadow: var(--shadow-sm); }

.panel { display: none; animation: fade .25s ease; }
.panel.active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.panel-head { display: flex; align-items: center; gap: 12px; margin-bottom: 4px; }
.panel-head h2 { margin: 0; font-size: 1.4rem; }
.panel-head .spacer { flex: 1; }
.panel-intro { color: var(--ink-soft); margin: 0 0 18px; font-size: 0.92rem; }

/* ─── Cartes ────────────────────────────────────────────────────────── */
.card {
  background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
  padding: 18px; margin-bottom: 16px;
}
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }

.person { display: flex; flex-direction: column; gap: 10px; }
.person .row1 { display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 40px; height: 40px; border-radius: 50%; flex: 0 0 auto;
  display: grid; place-items: center; font-weight: 700; color: #fff; font-size: 0.95rem;
  background: var(--leaf);
}
.person .name { font-weight: 700; font-family: var(--font-head); font-size: 1.05rem; color: var(--moss-deep); }
.person .actions { margin-left: auto; display: flex; gap: 4px; }
.note { font-size: 0.85rem; color: var(--ink-soft); font-style: italic; }

/* ─── Chips / tags ──────────────────────────────────────────────────── */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  font-size: 0.76rem; font-weight: 600; padding: 3px 10px; border-radius: 999px;
  background: var(--leaf-soft); color: var(--moss-deep); white-space: nowrap;
}
.chip.warn { background: #f6dca0; color: #6a4e12; }
.chip.terra { background: #f3c4a8; color: #7a3d1d; }
.chip.water { background: #bfe3f0; color: #235b72; }
.chip.muted { background: #e7e2d2; color: var(--ink-soft); }
.chip-toggle {
  cursor: pointer; border: 1.5px solid var(--line); background: #fff; color: var(--ink-soft);
  font-size: 0.78rem; font-weight: 600; padding: 5px 11px; border-radius: 999px; transition: all .12s;
}
.chip-toggle.on { background: var(--leaf); color: #fff; border-color: var(--leaf); }

/* ─── Équipes ───────────────────────────────────────────────────────── */
.team {
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); padding: 16px; display: flex; flex-direction: column; gap: 12px;
}
.team-head { display: flex; align-items: center; gap: 8px; }
.team-head .tname { font-family: var(--font-head); font-weight: 600; font-size: 1.05rem; color: var(--moss-deep); }
.team-head .count { margin-left: auto; font-size: 0.78rem; color: var(--ink-soft); background: var(--cream); padding: 2px 9px; border-radius: 999px; }
.member-toggles { display: flex; flex-wrap: wrap; gap: 6px; }
.empty { color: var(--ink-soft); font-style: italic; font-size: 0.9rem; padding: 8px 0; }

/* ─── Repas ─────────────────────────────────────────────────────────── */
.meal-card { padding: 14px 16px; }
.meal {
  display: flex; align-items: center; gap: 12px; padding: 2px 0 12px;
  border-bottom: 1px solid var(--line); margin-bottom: 10px;
}
.meal .slot { font-size: 0.75rem; font-weight: 700; color: var(--terra); text-transform: uppercase; letter-spacing: .04em; min-width: 92px; }
.meal .mname { font-weight: 600; }
.meal .assign { margin-left: auto; }
.meal select { width: auto; min-width: 150px; padding: 7px 10px; }

/* ─── Ingrédients d'un repas ────────────────────────────────────────── */
.ing-list { display: flex; flex-direction: column; gap: 6px; }
.ing { display: flex; align-items: center; gap: 10px; padding: 6px 0; }
.ing.done { opacity: .55; }
.ing.done .ing-lbl { text-decoration: line-through; }
.ing .ing-lbl { font-weight: 600; font-size: .92rem; }
.ing .ing-who { margin-left: auto; width: auto; min-width: 120px; padding: 5px 9px; font-size: .82rem; }
.ing-add { display: flex; gap: 8px; margin-top: 10px; }
.ing-add input { flex: 1; padding: 8px 11px; }
.ing .check { width: 20px; height: 20px; border-radius: 6px; }
.ing .check.on::after { font-size: 12px; }

/* ─── Checklist ─────────────────────────────────────────────────────── */
.check-cat { font-family: var(--font-head); color: var(--moss); margin: 18px 0 8px; font-size: 1rem; }
.item-card { padding: 12px 16px; margin-bottom: 8px; }
.item-card.done { opacity: .58; }
.item {
  display: flex; align-items: center; gap: 12px;
}
.item-card.done .lbl { text-decoration: line-through; }
.item .lbl { font-weight: 600; }
.item .qty { font-size: 0.82rem; color: var(--ink-soft); }
.item .who, .item .who-chips { margin-left: auto; font-size: 0.8rem; display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.item-card details { margin-top: 8px; border-top: 1px solid var(--line); padding-top: 8px; }
.check {
  width: 24px; height: 24px; border-radius: 8px; border: 2px solid var(--leaf);
  cursor: pointer; flex: 0 0 auto; display: grid; place-items: center; background: #fff; transition: all .12s;
}
.check.on { background: var(--leaf); }
.check.on::after { content: "✓"; color: #fff; font-weight: 800; font-size: 14px; }

/* ─── Récap / stats ─────────────────────────────────────────────────── */
.stats { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin-bottom: 20px; }
.stat { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow-sm); }
.stat .num { font-family: var(--font-head); font-size: 2rem; color: var(--moss-deep); line-height: 1; }
.stat .lbl { color: var(--ink-soft); font-size: 0.82rem; margin-top: 4px; }
.diet-summary { display: flex; flex-wrap: wrap; gap: 8px; }
.diet-summary .chip { font-size: 0.82rem; padding: 5px 12px; }

/* ─── Formulaires inline ────────────────────────────────────────────── */
.form-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.form-row .field { flex: 1; min-width: 140px; margin: 0; }
.inline-add { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.inline-add input { flex: 1; min-width: 120px; }

/* ─── Modale ────────────────────────────────────────────────────────── */
.modal-bg {
  position: fixed; inset: 0; background: rgba(46, 58, 48, .45);
  display: none; place-items: center; padding: 20px; z-index: 50; backdrop-filter: blur(3px);
}
.modal-bg.open { display: grid; }
.modal {
  background: var(--paper); border-radius: var(--radius); box-shadow: var(--shadow);
  width: min(480px, 100%); padding: 24px; max-height: 90vh; overflow: auto;
}
.modal h3 { margin: 0 0 16px; }
.modal .field { margin-bottom: 14px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }

/* ─── Pastille de clan ──────────────────────────────────────────────── */
.clan-dot { width: 12px; height: 12px; border-radius: 50%; flex: 0 0 auto; display: inline-block; box-shadow: inset 0 0 0 1.5px rgba(0,0,0,.06); }

/* ─── Olympiades : classement ───────────────────────────────────────── */
.board { background: linear-gradient(160deg, #fffdf6, #fdf3dc); }
.ranking { display: flex; flex-direction: column; gap: 8px; }
.rank-row { display: flex; align-items: center; gap: 10px; padding: 9px 12px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.rank-pos { font-size: 1.1rem; min-width: 32px; text-align: center; font-weight: 700; color: var(--ink-soft); }
.rank-name { font-weight: 700; font-family: var(--font-head); color: var(--moss-deep); }
.rank-pts { margin-left: auto; font-weight: 700; color: var(--terra); background: #fbe7d6; padding: 3px 12px; border-radius: 999px; }

/* ─── Olympiades : épreuves & saisie de points ──────────────────────── */
.event-head { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.event-head .ename { font-family: var(--font-head); font-weight: 600; font-size: 1.05rem; color: var(--moss-deep); }
.score-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
.score-cell { display: flex; align-items: center; gap: 8px; background: var(--cream); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 7px 10px; }
.score-team { font-weight: 600; font-size: 0.9rem; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.score-cell input { width: 62px; padding: 6px 8px; text-align: center; font-weight: 700; }

/* ─── Liste des séjours (sessions) ──────────────────────────────────── */
.sess-list { display: flex; flex-direction: column; gap: 8px; }
.sess-row { display: flex; align-items: center; gap: 6px; }
.sess-pick { flex: 1; text-align: left; cursor: pointer; font: inherit; display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 10px 14px; border: 1.5px solid var(--line); border-radius: var(--radius-sm); background: #fff; color: var(--ink); transition: all .12s; }
.sess-pick:hover { border-color: var(--leaf); }
.sess-row.current .sess-pick { background: rgba(111,174,107,.12); border-color: var(--leaf); }
.sess-code { font-size: 0.72rem; color: var(--ink-soft); background: var(--cream); padding: 2px 8px; border-radius: 999px; letter-spacing: .05em; }
#session-switch { max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ─── Invitation ────────────────────────────────────────────────────── */
.invite-banner {
  display: flex; align-items: center; gap: 14px;
  background: linear-gradient(120deg, #eaf6e4, #fdf3dc);
  border: 1px solid var(--leaf-soft);
}
.invite-banner-txt { display: flex; flex-direction: column; gap: 2px; }
.invite-banner-txt b { color: var(--moss-deep); }
.invite-banner-txt span { font-size: 0.85rem; color: var(--ink-soft); }
.invite-banner .btn { margin-left: auto; flex: 0 0 auto; }
.invite-code-sm { font-weight: 800; letter-spacing: .08em; color: var(--terra); }
.invite-box { text-align: center; background: var(--cream); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 18px; }
.invite-code { font-family: var(--font-head); font-size: 2.2rem; font-weight: 700; letter-spacing: .12em; color: var(--moss-deep); }
.invite-link { margin-top: 8px; font-size: 0.85rem; color: var(--ink-soft); word-break: break-all; }

.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--moss-deep); color: #fff; padding: 11px 20px; border-radius: 999px;
  box-shadow: var(--shadow); opacity: 0; transition: all .25s; z-index: 60; font-weight: 600; font-size: 0.9rem;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ─── 404 ───────────────────────────────────────────────────────────── */
.nf { min-height: 100vh; display: grid; place-items: center; text-align: center; padding: 24px; }
.nf .big { font-size: 80px; }
.nf h1 { font-size: 2rem; margin: 8px 0; }
.nf p { color: var(--ink-soft); margin-bottom: 20px; }

@media (max-width: 540px) {
  .meal { flex-wrap: wrap; }
  .meal .assign { margin-left: 0; width: 100%; }
  .meal select { width: 100%; }
  /* Sur mobile, le titre passe sur sa propre ligne, les boutons en dessous. */
  .panel-head { flex-wrap: wrap; }
  .panel-head h2 { width: 100%; }
  .panel-head .spacer { display: none; }
}
