:root {
  --navy: #1f3a5f;
  --navy-2: #2c4f7c;
  --gold: #c8963e;
  --gold-soft: #f3e4c6;
  --bg: #faf6ef;
  --card: #ffffff;
  --text: #22252b;
  --muted: #646a75;
  --line: #e6dfd2;
  --green: #2e7d4f;
  --green-soft: #e3f2e8;
  --orange: #b9741a;
  --orange-soft: #fbeed9;
  --red: #b3372f;
  --red-soft: #f8e3e1;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(31, 58, 95, .06), 0 4px 14px rgba(31, 58, 95, .07);
  --serif: Georgia, "Times New Roman", serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { font-size: 18px; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: var(--sans); line-height: 1.55;
}
img { max-width: 100%; display: block; }
svg { width: 1.2em; height: 1.2em; flex-shrink: 0; }
a { color: var(--navy-2); }
h1, h2, h3 { font-family: var(--serif); color: var(--navy); line-height: 1.2; margin: 0 0 .5em; }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.1rem; }
p { margin: 0 0 .8em; }
.muted { color: var(--muted); }
.small { font-size: .86rem; }
.hidden { display: none !important; }

.splash {
  min-height: 100vh; display: grid; place-items: center;
  font: 700 4rem var(--serif); color: var(--gold);
}

/* ---------- En-tête et navigation ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: var(--navy); color: #fff;
  box-shadow: 0 2px 10px rgba(0,0,0,.15);
}
.topbar-in {
  max-width: 1100px; margin: 0 auto; padding: 10px 16px;
  display: flex; align-items: center; gap: 16px;
}
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; min-width: 0; }
.brand img { width: 40px; height: 40px; border-radius: 10px; }
.brand b { font: 700 1.2rem var(--serif); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav { display: flex; gap: 4px; margin-left: auto; }
.nav a {
  color: #dfe7f2; text-decoration: none; padding: 8px 12px; border-radius: 10px;
  font-weight: 600; font-size: .95rem; display: flex; align-items: center; gap: 6px;
}
.nav a:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav a.on { background: rgba(255,255,255,.14); color: #fff; }
.nav svg { width: 20px; height: 20px; }
.top-actions { display: flex; align-items: center; gap: 8px; }
.top-actions a { color: #fff; text-decoration: none; position: relative; display: flex; }
.badge {
  position: absolute; top: -6px; right: -8px; background: var(--gold); color: var(--navy);
  font-size: .7rem; font-weight: 800; border-radius: 999px; padding: 1px 6px;
}
.admin-link {
  font-size: .85rem; font-weight: 700; border: 1px solid rgba(255,255,255,.35);
  border-radius: 999px; padding: 4px 12px;
}

.bottomnav { display: none; }

main { max-width: 1100px; margin: 0 auto; padding: 24px 16px 60px; }

@media (max-width: 820px) {
  .nav { display: none; }
  .top-actions { margin-left: auto; }
  .bottomnav {
    display: grid; grid-template-columns: repeat(5, 1fr);
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 20;
    background: #fff; border-top: 1px solid var(--line);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .bottomnav a {
    display: flex; flex-direction: column; align-items: center; gap: 2px;
    padding: 8px 2px 7px; color: var(--muted); text-decoration: none;
    font-size: .72rem; font-weight: 600;
  }
  .bottomnav a.on { color: var(--navy); }
  .bottomnav a.on svg { stroke: var(--gold); }
  .bottomnav svg { width: 26px; height: 26px; }
  main { padding-bottom: 110px; }
  h1 { font-size: 1.5rem; }
}

/* ---------- Éléments communs ---------- */
.card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 20px; margin-bottom: 18px;
}
.section { margin: 30px 0 14px; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.section h2 { margin: 0; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head h1 { margin: 0; }
.back { display: inline-flex; align-items: center; gap: 4px; margin-bottom: 12px; text-decoration: none; font-weight: 600; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 10px 20px; border-radius: 12px; border: 2px solid transparent;
  font: 700 1rem var(--sans); cursor: pointer; text-decoration: none;
  background: var(--navy); color: #fff; transition: filter .15s, background .15s;
}
.btn:hover { filter: brightness(1.12); }
.btn:disabled { opacity: .55; cursor: wait; }
.btn.gold { background: var(--gold); color: #fff; }
.btn.light { background: #fff; color: var(--navy); border-color: var(--line); }
.btn.danger { background: #fff; color: var(--red); border-color: #e9c3bf; }
.btn.wa { background: #1fa855; }
.btn.small { min-height: 38px; padding: 6px 14px; font-size: .9rem; border-radius: 10px; }
.btn svg { width: 20px; height: 20px; }
.btns { display: flex; gap: 10px; flex-wrap: wrap; }

.alert {
  border-radius: 12px; padding: 14px 16px; margin-bottom: 16px; font-weight: 600;
  background: var(--gold-soft); color: #6b4a10; display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap;
}
.alert.err { background: var(--red-soft); color: var(--red); }
.alert.ok { background: var(--green-soft); color: var(--green); }

.empty { text-align: center; color: var(--muted); padding: 30px 10px; }
.loading { text-align: center; color: var(--muted); padding: 60px 10px; }

.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.chip {
  border: 2px solid var(--line); background: #fff; color: var(--text);
  border-radius: 999px; padding: 6px 14px; font: 600 .92rem var(--sans); cursor: pointer;
}
.chip.on { background: var(--navy); color: #fff; border-color: var(--navy); }

/* ---------- Formulaires ---------- */
label { display: block; font-weight: 700; margin-bottom: 14px; }
label .hint { font-weight: 400; color: var(--muted); font-size: .85rem; }
input[type=text], input[type=tel], input[type=password], input[type=date], input[type=time],
input[type=url], input[type=search], select, textarea {
  display: block; width: 100%; margin-top: 6px;
  font: 400 1rem var(--sans); color: var(--text);
  padding: 12px 14px; border: 2px solid var(--line); border-radius: 12px; background: #fff;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--navy-2); }
textarea { min-height: 120px; resize: vertical; }
.check { display: flex; gap: 10px; align-items: center; font-weight: 600; }
.check input { width: 22px; height: 22px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
@media (max-width: 560px) { .row2 { grid-template-columns: 1fr; } }
.form-err { color: var(--red); font-weight: 600; min-height: 1.2em; margin: 4px 0 10px; }

/* ---------- Connexion ---------- */
.auth {
  min-height: 100vh; display: grid; place-items: center; padding: 24px 16px;
  background:
    radial-gradient(1200px 500px at 50% -10%, rgba(200,150,62,.25), transparent 60%),
    linear-gradient(180deg, var(--navy) 0, var(--navy) 260px, var(--bg) 260px);
}
.auth-box { width: 100%; max-width: 460px; }
.auth-head { text-align: center; color: #fff; margin-bottom: 20px; }
.auth-head img { width: 84px; height: 84px; margin: 0 auto 10px; border-radius: 20px; box-shadow: 0 6px 20px rgba(0,0,0,.25); }
.auth-head h1 { color: #fff; font-size: 2rem; margin: 0; }
.auth-head p { color: #dbe4f0; margin: 4px 0 0; }
.tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 18px; background: #f0ebe1; padding: 5px; border-radius: 12px; }
.tabs button {
  border: 0; background: transparent; padding: 10px; border-radius: 9px;
  font: 700 .95rem var(--sans); color: var(--muted); cursor: pointer;
}
.tabs button.on { background: #fff; color: var(--navy); box-shadow: var(--shadow); }

/* ---------- Accueil ---------- */
.hero {
  background: linear-gradient(135deg, var(--navy), var(--navy-2));
  color: #fff; border-radius: var(--radius); padding: 26px 24px; margin-bottom: 20px; position: relative; overflow: hidden;
}
.hero::after {
  content: "16"; position: absolute; right: -10px; bottom: -50px;
  font: 700 11rem var(--serif); color: rgba(255,255,255,.06); pointer-events: none;
}
.hero h1 { color: #fff; }
.hero p { color: #dbe4f0; max-width: 720px; margin: 0; }
.quick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 8px; }
.quick a {
  background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 10px;
  text-align: center; text-decoration: none; color: var(--navy); font-weight: 700; font-size: .95rem;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
}
.quick svg { width: 30px; height: 30px; stroke: var(--gold); }
.stats { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 30px; color: var(--muted); font-size: .9rem; }
.stats b { color: var(--navy); font-size: 1.1rem; }

/* ---------- Rencontres ---------- */
.ev {
  display: flex; gap: 16px; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 16px; margin-bottom: 14px; text-decoration: none; color: inherit; align-items: flex-start;
}
.ev.past { opacity: .85; }
.datebox {
  flex: 0 0 74px; text-align: center; border-radius: 12px; overflow: hidden;
  border: 2px solid var(--gold-soft); background: #fff;
}
.datebox .m { background: var(--gold); color: #fff; font-weight: 800; font-size: .75rem; text-transform: uppercase; padding: 3px 0; letter-spacing: .05em; }
.datebox .d { font: 700 1.8rem var(--serif); color: var(--navy); line-height: 1.2; padding-top: 2px; }
.datebox .y { font-size: .75rem; color: var(--muted); padding-bottom: 4px; }
.ev-body { flex: 1; min-width: 0; }
.ev-body h3 { margin: 0 0 4px; font-size: 1.15rem; }
.meta { display: flex; flex-wrap: wrap; gap: 4px 14px; color: var(--muted); font-size: .92rem; }
.meta span { display: inline-flex; align-items: center; gap: 4px; }
.meta svg, .muted svg, .person svg { width: 16px; height: 16px; flex: 0 0 16px; vertical-align: -2px; }
.back svg { width: 20px; height: 20px; }
.pill { display: inline-block; border-radius: 999px; padding: 2px 10px; font-size: .8rem; font-weight: 700; }
.pill.yes { background: var(--green-soft); color: var(--green); }
.pill.maybe { background: var(--orange-soft); color: var(--orange); }
.pill.no { background: var(--red-soft); color: var(--red); }
.pill.gold { background: var(--gold-soft); color: #7a5512; }

.rsvp { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 14px; }
.rsvp button {
  min-height: 52px; border-radius: 12px; border: 2px solid var(--line); background: #fff;
  font: 700 .95rem var(--sans); cursor: pointer; color: var(--text); padding: 6px;
}
.rsvp button.on.yes { background: var(--green); border-color: var(--green); color: #fff; }
.rsvp button.on.maybe { background: var(--orange); border-color: var(--orange); color: #fff; }
.rsvp button.on.no { background: var(--red); border-color: var(--red); color: #fff; }
.event-cover { width: 100%; max-height: 380px; object-fit: cover; border-radius: var(--radius); margin-bottom: 18px; }
.info-list { display: grid; gap: 10px; margin: 14px 0; }
.info-list div { display: flex; gap: 10px; align-items: flex-start; }
.info-list svg { width: 22px; height: 22px; flex: 0 0 22px; stroke: var(--gold); margin-top: 2px; }
.people { display: flex; flex-wrap: wrap; gap: 8px; }
.person {
  display: inline-flex; align-items: center; gap: 8px; background: #f5f1e9; border-radius: 999px;
  padding: 4px 12px 4px 4px; text-decoration: none; color: var(--text); font-size: .92rem; font-weight: 600;
}

/* ---------- Avatars ---------- */
.av { border-radius: 50%; object-fit: cover; flex: 0 0 auto; }
.av-ph { display: inline-grid; place-items: center; color: #fff; font-weight: 800; background: hsl(var(--h, 210) 38% 45%); }
.av-sm { width: 30px; height: 30px; font-size: .75rem; }
.av-md { width: 46px; height: 46px; font-size: .95rem; }
.av-lg { width: 84px; height: 84px; font-size: 1.6rem; }
.av-xl { width: 140px; height: 140px; font-size: 2.6rem; }

/* ---------- Photos ---------- */
.albums { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; }
.album {
  background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden;
  text-decoration: none; color: inherit; display: flex; flex-direction: column;
}
.album .cover { aspect-ratio: 4/3; background: #ece5d8 center/cover no-repeat; display: grid; place-items: center; color: #b8ab92; }
.album .cover img { width: 100%; height: 100%; object-fit: cover; }
.album .cover svg { width: 46px; height: 46px; }
.album-body { padding: 12px 14px 14px; }
.album-body h3 { margin: 0 0 4px; }
.grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px;
}
.grid a, .grid button { display: block; aspect-ratio: 1; border-radius: 8px; overflow: hidden; background: #ece5d8; padding: 0; border: 0; cursor: zoom-in; position: relative; }
.grid img { width: 100%; height: 100%; object-fit: cover; transition: transform .25s; }
.grid a:hover img, .grid button:hover img { transform: scale(1.04); }
.grid .cc {
  position: absolute; right: 6px; bottom: 6px; background: rgba(0,0,0,.6); color: #fff;
  border-radius: 999px; font-size: .72rem; padding: 1px 7px; font-weight: 700;
}
@media (max-width: 560px) {
  .grid { grid-template-columns: repeat(3, 1fr); gap: 4px; }
  .albums { grid-template-columns: 1fr 1fr; gap: 10px; }
  .album-body { padding: 10px; }
  .album-body h3 { font-size: 1rem; }
}

.progress { height: 12px; background: #ece5d8; border-radius: 999px; overflow: hidden; margin: 10px 0; }
.progress div { height: 100%; background: var(--gold); width: 0; transition: width .2s; }

/* Visionneuse */
.lb {
  position: fixed; inset: 0; z-index: 60; background: rgba(10, 14, 22, .96);
  display: flex; flex-direction: column; color: #fff;
}
.lb-top { display: flex; align-items: center; gap: 8px; padding: 10px 12px; }
.lb-top .count { margin-right: auto; color: #b9c2d0; font-weight: 600; }
.lb-top a, .lb-top button {
  background: rgba(255,255,255,.1); color: #fff; border: 0; border-radius: 10px;
  min-height: 44px; padding: 8px 12px; font: 600 .9rem var(--sans); cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center; gap: 6px;
}
.lb-top svg { width: 20px; height: 20px; }
.lb-stage { flex: 1; min-height: 0; position: relative; display: flex; align-items: center; justify-content: center; touch-action: pan-y; }
.lb-stage img { max-width: 100%; max-height: 100%; object-fit: contain; user-select: none; }
.lb-prev, .lb-next {
  position: absolute; top: 50%; transform: translateY(-50%); width: 56px; height: 56px; border-radius: 50%;
  border: 0; background: rgba(255,255,255,.12); color: #fff; font-size: 2rem; cursor: pointer;
}
.lb-prev { left: 12px; } .lb-next { right: 12px; }
.lb-info { padding: 12px 16px 18px; max-height: 40vh; overflow: auto; background: rgba(255,255,255,.04); }
.lb-info .cap { font-size: 1.05rem; margin-bottom: 4px; }
.lb-info .muted { color: #9aa4b4; }
.lb-info .comments { margin-top: 12px; }
.lb-info .comment { background: rgba(255,255,255,.07); }
.lb-info .comment b { color: #fff; }
.lb-info textarea { background: #1b2230; color: #fff; border-color: #34405a; }
@media (max-width: 560px) { .lb-prev, .lb-next { display: none; } .lb-top .lbl { display: none; } }

/* ---------- Messages ---------- */
.post .post-head { display: flex; gap: 12px; align-items: center; margin-bottom: 10px; }
.post .post-head .who { flex: 1; min-width: 0; }
.post .post-head b { display: block; }
.post h3 { margin: 6px 0 6px; font-size: 1.2rem; }
.post .body { white-space: normal; overflow-wrap: anywhere; }
.post .post-img { border-radius: 12px; margin: 12px 0 4px; max-height: 520px; width: auto; cursor: zoom-in; }
.post-actions { display: flex; gap: 6px; flex-wrap: wrap; border-top: 1px solid var(--line); margin-top: 12px; padding-top: 10px; }
.linkbtn {
  border: 0; background: none; color: var(--navy-2); font: 600 .92rem var(--sans); cursor: pointer;
  padding: 6px 8px; border-radius: 8px; display: inline-flex; gap: 6px; align-items: center;
}
.linkbtn:hover { background: #f1ece3; }
.linkbtn.red { color: var(--red); }
.linkbtn svg { width: 18px; height: 18px; }
.pinned { border: 2px solid var(--gold-soft); }

.comments { margin-top: 12px; }
.comment { background: #f6f2ea; border-radius: 12px; padding: 10px 12px; margin-bottom: 8px; display: flex; gap: 10px; }
.comment > div { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.comment .del { margin-left: auto; }
.comment-form { display: flex; gap: 8px; align-items: flex-end; }
.comment-form textarea { min-height: 50px; margin: 0; flex: 1; }

/* ---------- Membres ---------- */
.members { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.member {
  background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px;
  display: flex; gap: 12px; align-items: center; text-decoration: none; color: inherit;
}
.member b { display: block; line-height: 1.3; }
.profile-top { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; }
.profile-top h1 { margin-bottom: 4px; }

/* ---------- Admin ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-weight: 700; font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; }
td select { margin: 0; padding: 6px 8px; min-width: 110px; }
.pending-row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; padding: 12px 0; border-bottom: 1px solid var(--line); }
.pending-row .who { flex: 1; min-width: 180px; }
.secret {
  font: 700 1.6rem ui-monospace, Consolas, monospace; letter-spacing: .12em; text-align: center;
  background: var(--gold-soft); color: var(--navy); border-radius: 12px; padding: 14px; margin: 10px 0;
}

/* ---------- Fenêtres ---------- */
.modal {
  position: fixed; inset: 0; z-index: 50; background: rgba(15, 22, 35, .55);
  display: flex; align-items: flex-start; justify-content: center; padding: 30px 12px; overflow-y: auto;
}
.modal-box {
  background: #fff; border-radius: 18px; width: 100%; max-width: 560px; padding: 22px;
  box-shadow: 0 20px 60px rgba(0,0,0,.3); position: relative;
}
.modal-box h2 { padding-right: 40px; }
.modal-close {
  position: absolute; top: 12px; right: 12px; width: 42px; height: 42px; border-radius: 50%;
  border: 0; background: #f1ece3; font-size: 1.4rem; cursor: pointer; color: var(--text);
}
@media (max-width: 560px) {
  .modal { padding: 0; align-items: stretch; }
  .modal-box { border-radius: 0; min-height: 100%; }
}

#toast {
  position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%) translateY(20px);
  background: var(--navy); color: #fff; padding: 12px 20px; border-radius: 12px; font-weight: 600;
  opacity: 0; pointer-events: none; transition: .25s; z-index: 80; max-width: calc(100% - 32px); text-align: center;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.err { background: var(--red); }

.preview-img { max-height: 180px; border-radius: 10px; margin-top: 8px; }
