:root {
  --green: #1747d1; --green-dark: #0f33a0; --green-light: #e8efff;
  --lime: #2fcf5a; --lime-dark: #1fa64a; --cyan: #19b8e6;
  --amber: #e8a33d; --ink: #121a2e; --muted: #5f6b82; --line: #dde4f0;
  --bg: #f4f7fc; --card: #fff; --danger: #b3412f; --radius: 14px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink); background: var(--bg);
}
* { box-sizing: border-box; }
body { margin: 0; padding-bottom: 76px; font-size: 16px; line-height: 1.5; }
a { color: var(--green); }
h1 { font-size: 1.6rem; margin: .4em 0 .5em; line-height: 1.2; }
h2 { font-size: 1.2rem; } h3 { font-size: 1.05rem; margin-top: 1.4em; }
main { max-width: 960px; margin: 0 auto; padding: 16px; outline: none; }
.muted { color: var(--muted); }
.loading, .empty { color: var(--muted); padding: 24px 0; text-align: center; }
[hidden] { display: none !important; }

/* barre du haut */
.topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 10px 16px; background: var(--card); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 1.1rem; color: var(--ink); text-decoration: none; }
.search { flex: 1; min-width: 200px; }
.search input { width: 100%; padding: 9px 14px; border: 1px solid var(--line); border-radius: 999px; font: inherit; background: var(--bg); }
.nav { display: flex; align-items: center; gap: 14px; }
.nav a { text-decoration: none; color: var(--ink); font-weight: 500; position: relative; }
.nav a.active { color: var(--green); }
.count { display: inline-block; min-width: 20px; padding: 0 6px; margin-left: 4px; border-radius: 999px; background: var(--danger);
  color: #fff; font-size: .75rem; text-align: center; line-height: 20px; }
.pill { border: 1px solid var(--line); background: var(--bg); border-radius: 999px; padding: 6px 12px; font: inherit; cursor: pointer; }
.pill.on { background: var(--lime-dark); color: #fff; border-color: var(--lime-dark); }

/* barre d'onglets mobile */
.tabbar { display: none; }
@media (max-width: 720px) {
  .nav { display: none; }
  .search { order: 3; flex-basis: 100%; }
  .tabbar { display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 10; background: var(--card);
    border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); justify-content: space-around; align-items: center; }
  .tabbar a { display: flex; flex-direction: column; align-items: center; font-size: 1.2rem; text-decoration: none; color: var(--muted); position: relative; }
  .tabbar a span { font-size: .7rem; }
  .tabbar a.active { color: var(--green); }
  .tabbar .count { position: absolute; top: -4px; right: -10px; font-size: .65rem; }
  .pill.tab { font-size: .8rem; }
}
@media (min-width: 721px) { body { padding-bottom: 0; } }

/* boutons */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 10px 16px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--card); color: var(--ink); font: inherit; font-weight: 500; cursor: pointer; text-decoration: none; }
.btn:hover { border-color: var(--green); }
.btn.primary { background: var(--green); color: #fff; border-color: var(--green); }
.btn.primary:hover { background: var(--green-dark); }
.btn.small { padding: 6px 12px; font-size: .9rem; }
.btn.ghost { background: transparent; }
.btn.danger, .link.danger { color: var(--danger); }
.btn:disabled { opacity: .6; cursor: default; }
.link { background: none; border: none; color: var(--green); cursor: pointer; font: inherit; text-decoration: underline; padding: 4px; }
.btn-row, .actions-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 10px 0; }

/* accueil */
.hero { background: radial-gradient(circle at 85% 110%, rgba(47,207,90,.55), transparent 55%), linear-gradient(135deg, #0a2a8c, #1747d1 55%, #128fb8); color: #fff; padding: 28px; border-radius: var(--radius); margin-bottom: 20px; }
.hero h1 { font-size: 1.9rem; } .hero h1 span { color: #9dff8a; }
.hero a { color: #fff; } .hero .btn { color: var(--ink); } .hero .btn.primary { background: var(--lime); border-color: var(--lime); color: #06240f; font-weight: 600; }
.hero .btn.primary:hover { background: #45e36f; }
.hero.small { padding: 20px; } .hero.small h1 { font-size: 1.4rem; }
.notice { background: rgba(255,255,255,.15); padding: 10px 14px; border-radius: 10px; }
.two-services { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin: 16px 0; }
.two-services > div { background: rgba(255,255,255,.12); padding: 14px; border-radius: 10px; }
.two-services p { margin: 4px 0 0; }
.section-title { margin-top: 28px; }
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.cat-card { display: flex; flex-direction: column; gap: 4px; padding: 16px; border-radius: var(--radius); background: var(--card);
  border: 1px solid var(--line); text-decoration: none; color: var(--ink); transition: transform .1s, box-shadow .1s; }
.cat-card:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(0,0,0,.07); }
.cat-icon { font-size: 2rem; } .cat-name { font-weight: 600; } .cat-meta { font-size: .8rem; color: var(--muted); }

/* listes de thèmes */
.crumbs { font-size: .9rem; color: var(--muted); margin: 0; }
.theme-list { list-style: none; padding: 0; margin: 0; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.theme-list li + li { border-top: 1px solid var(--line); }
.theme-list a { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 14px 16px; text-decoration: none; color: var(--ink); }
.theme-list a:hover { background: var(--green-light); }
.mine { font-size: .75rem; background: var(--green-light); color: var(--green); padding: 2px 8px; border-radius: 999px; margin-left: 6px; }
.mine-box { background: var(--green-light); padding: 10px 14px; border-radius: 10px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* filtres */
.filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin: 16px 0 6px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--card); }
.seg button { border: none; background: none; padding: 8px 14px; font: inherit; cursor: pointer; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button.on { background: var(--green); color: #fff; }
.check { display: flex; align-items: center; gap: 8px; cursor: pointer; }

/* fiches membres */
.members { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 12px; }
.member, .profile-card, .card, .cb { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.card { margin-bottom: 16px; } .card h2 { margin-top: 0; }
.card.narrow { max-width: 440px; margin: 20px auto; }
.m-head { display: flex; gap: 12px; align-items: center; }
.m-id { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.m-id h1 { margin: 0; }
.m-name { font-weight: 600; font-size: 1.05rem; color: var(--ink); text-decoration: none; }
.avatar { width: 46px; height: 46px; flex: none; border-radius: 50%; background: linear-gradient(135deg, #1747d1, #19b8e6 60%, #2fcf5a); color: #fff;
  display: grid; place-items: center; font-weight: 700; font-size: 1.2rem; text-decoration: none; }
.avatar.big { width: 72px; height: 72px; font-size: 1.8rem; }
.m-level { text-align: right; display: flex; flex-direction: column; } .m-level small { color: var(--muted); }
.stars { color: var(--amber); letter-spacing: 1px; white-space: nowrap; } .stars .off { color: #d9dedc; }
.stars.big { font-size: 1.15rem; }
.m-tags { margin: 10px 0 6px; display: flex; gap: 6px; }
.tag { font-size: .8rem; background: var(--bg); border: 1px solid var(--line); padding: 2px 8px; border-radius: 999px; }
.m-avail { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: .85rem; padding: 4px 10px; border-radius: 999px; font-weight: 500; }
.badge.now { background: #dcf9e3; color: #0f6b2c; }
.badge.slots { background: #fff3dc; color: #8a5a10; }
.badge.cb { background: #ddf4fc; color: #0b5f7d; }
.badge.off { background: var(--bg); color: var(--muted); }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--lime-dark); box-shadow: 0 0 0 3px rgba(47,207,90,.3); animation: pulse 1.8s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px rgba(47,207,90,0); } }
.slots-list { flex-basis: 100%; display: flex; flex-wrap: wrap; gap: 4px; }
.slot { font-size: .8rem; color: var(--muted); background: var(--bg); padding: 2px 8px; border-radius: 6px; }
.m-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 10px; }
.bio { white-space: pre-line; }

/* profil */
.form { display: flex; flex-direction: column; gap: 12px; }
.form label:not(.check) { display: flex; flex-direction: column; gap: 4px; font-weight: 500; }
.form.inline { flex-direction: row; flex-wrap: wrap; }
input, textarea, select { font: inherit; padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
input[type=checkbox], input[type=radio] { width: 18px; height: 18px; accent-color: var(--green); }
fieldset { border: 1px solid var(--line); border-radius: 10px; display: flex; flex-direction: column; gap: 8px; }
.full { width: 100%; }
.slot-add { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 8px; }
.slot-edit { padding-left: 18px; }
.my-theme { display: grid; grid-template-columns: 1.4fr auto auto auto auto; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
@media (max-width: 720px) { .my-theme { grid-template-columns: 1fr 1fr; } }
.star-pick { display: flex; align-items: center; gap: 2px; }
.star-pick button { border: none; background: none; font-size: 1.4rem; color: #d9dedc; cursor: pointer; padding: 0 1px; }
.star-pick button.on { color: var(--amber); }
.star-pick small { margin-left: 6px; color: var(--muted); }
.level-radio { display: flex; flex-direction: column; gap: 6px; }
.seg-radio { flex-direction: row; flex-wrap: wrap; }

/* rappels */
.cb-list { display: flex; flex-direction: column; gap: 10px; }
.cb.pending { border-left: 4px solid var(--amber); }
.cb.done, .cb.declined { opacity: .75; }
.msg { background: var(--bg); padding: 8px 12px; border-radius: 8px; margin: 8px 0; }
.stats { display: flex; gap: 12px; flex-wrap: wrap; }
.stats div { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 20px; display: flex; flex-direction: column; }
.stats strong { font-size: 1.6rem; color: var(--green); }
.charter li { margin-bottom: 10px; }

/* dialogue & toast */
dialog { border: none; border-radius: var(--radius); padding: 20px; width: min(520px, 94vw); max-height: 88vh; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
dialog::backdrop { background: rgba(6,16,40,.5); }
dialog h2 { margin-top: 0; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }
.pick-list { max-height: 50vh; overflow: auto; margin-top: 10px; }
.pick-list details { border-bottom: 1px solid var(--line); padding: 6px 0; }
.pick-list summary { cursor: pointer; font-weight: 600; padding: 4px 0; }
.pick-list .check { padding: 4px 0 4px 18px; }
#toast { position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%) translateY(20px); background: var(--ink); color: #fff;
  padding: 10px 18px; border-radius: 10px; opacity: 0; pointer-events: none; transition: .25s; z-index: 100; max-width: 90vw; }
#toast.show { opacity: 1; transform: translateX(-50%); }
#toast.error { background: var(--danger); }
.btn.call { background: var(--lime-dark); border-color: var(--lime-dark); color: #fff; font-weight: 600; }
.btn.call:hover { background: #17903f; }
