/* CJD Perpignan — app membres. Mobile d'abord. */
:root {
  --green: #00d656;
  --green-soft: #d5ffe6;
  --green-ink: #00692a;
  --ink: #0c0c0c;
  --ink-2: #4a4f57;
  --line: #e6e8eb;
  --bg: #ffffff;
  --bg-2: #f5f6f7;
  --radius: 14px;
  --tabbar: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg-2); color: var(--ink);
  font: 16px/1.45 "Open Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  padding-bottom: calc(var(--tabbar) + var(--safe-b) + 16px);
}
a { color: inherit; }
h1 { font-size: 1.6rem; line-height: 1.2; margin: 8px 0 16px; letter-spacing: -.01em; }
h2 { font-size: 1.05rem; margin: 24px 0 10px; }
h3 { font-size: .95rem; margin: 16px 0 8px; color: var(--ink-2); }
.ico { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.sr, .skip:not(:focus) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip:focus { position: fixed; top: 8px; left: 8px; z-index: 50; background: var(--ink); color: #fff; padding: 8px 12px; border-radius: 8px; }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }

/* En-tête et onglets */
.topbar {
  position: sticky; top: 0; z-index: 10; background: var(--bg);
  border-bottom: 1px solid var(--line); padding: calc(env(safe-area-inset-top, 0px) + 10px) 16px 10px;
  display: flex; align-items: center; justify-content: space-between;
}
.brand img { display: block; height: 36px; width: auto; }
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: var(--bg); border-top: 1px solid var(--line);
  height: calc(var(--tabbar) + var(--safe-b)); padding-bottom: var(--safe-b);
}
.tabs a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  text-decoration: none; font-size: .68rem; font-weight: 600; color: var(--ink-2);
}
.tabs a[aria-current="page"] { color: var(--ink); }
.tabs a[aria-current="page"] .ico { stroke: var(--ink); background: var(--green-soft); border-radius: 999px; padding: 2px 10px; width: 44px; height: 26px; }

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

/* Accueil */
.hello { margin-top: 4px; }
.eyebrow { text-transform: uppercase; font-size: .72rem; font-weight: 700; letter-spacing: .08em; color: var(--green-ink); margin: 0 0 8px; }
.featured-card {
  display: flex; gap: 14px; text-decoration: none; background: var(--ink); color: #fff;
  border-radius: var(--radius); padding: 16px; box-shadow: 0 6px 20px rgb(0 0 0 / .12);
}
.featured-card .date-block { background: var(--green); color: var(--ink); }
.featured-card .meta { color: #d7dbe0; }
.featured-card .badge-p1 { background: var(--green); color: var(--ink); }
.featured-body { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.featured-body strong { font-size: 1.15rem; line-height: 1.25; }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 20px; }
.tile {
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; text-decoration: none; display: flex; flex-direction: column; gap: 6px; min-height: 120px;
}
.tile-ico { width: 44px; height: 44px; border-radius: 12px; background: var(--green-soft); display: grid; place-items: center; color: var(--green-ink); margin-bottom: auto; }
.tile strong { font-size: 1.02rem; }
.tile-count { font-size: .85rem; color: var(--ink-2); }
.tile:active, .event:active, .person:active, .res:active { transform: scale(.99); }
.install-btn { margin-top: 20px; width: 100%; }
.install-ios { margin-top: 16px; font-size: .9rem; color: var(--ink-2); text-align: center; }

/* Badges, boutons */
.badges { display: flex; flex-wrap: wrap; gap: 6px; }
.badge {
  display: inline-flex; align-items: center; gap: 4px; font-size: .7rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .04em; padding: 3px 8px; border-radius: 999px; width: fit-content;
}
.badge .ico { width: 12px; height: 12px; fill: currentColor; stroke: none; }
.badge-p1 { background: var(--ink); color: var(--green); }
.badge-p2 { background: var(--green-soft); color: var(--green-ink); }
.badge-p3 { background: var(--bg-2); color: var(--ink-2); border: 1px solid var(--line); }
.badge-hors, .badge-section, .badge-cat { background: #eef1ff; color: #2c3a8c; }
.btn, .install-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 18px;
  border-radius: 12px; border: 0; background: var(--green); color: var(--ink); font: inherit; font-weight: 700;
  text-decoration: none; cursor: pointer;
}
.btn-ghost { background: transparent; border: 1px solid var(--line); }
.icon-btn {
  width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; text-decoration: none;
  border: 1px solid var(--line); background: var(--bg);
}
.icon-btn.call { background: var(--green); border-color: var(--green); }
.icon-btn.wa { color: #128c4b; }

/* Événements */
.filters { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.chips { display: flex; gap: 8px; }
.chips-scroll { overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 0 16px 4px; }
.chips-scroll::-webkit-scrollbar { display: none; }
.chip {
  flex: none; padding: 7px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--bg);
  text-decoration: none; font-size: .88rem; font-weight: 600; white-space: nowrap;
}
.chip[aria-current="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.chip-soft[aria-current="true"] { background: var(--green-soft); border-color: var(--green); color: var(--ink); }
.pinned h2 { display: flex; align-items: center; gap: 6px; }
.pinned h2 .ico { width: 18px; height: 18px; fill: var(--green); stroke: var(--ink); stroke-width: 1.2; }
.event-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.month { font-weight: 700; color: var(--ink-2); font-size: .82rem; text-transform: uppercase; letter-spacing: .06em; margin-top: 14px; }
.event {
  display: flex; gap: 14px; padding: 14px; text-decoration: none; background: var(--bg);
  border: 1px solid var(--line); border-radius: var(--radius); border-left: 5px solid var(--line);
}
.event.p1 { border-left-color: var(--green); box-shadow: 0 4px 14px rgb(0 214 86 / .12); }
.event.p2 { border-left-color: #8fe3b1; }
.event.p3 { opacity: .92; }
.event-body { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.event-body strong { font-size: 1.02rem; line-height: 1.3; }
.date-block {
  flex: none; width: 54px; height: 58px; border-radius: 12px; background: var(--bg-2);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-size: .72rem; text-transform: uppercase; font-weight: 700; line-height: 1.1;
}
.date-block b { font-size: 1.45rem; }
.meta { display: flex; align-items: center; gap: 5px; color: var(--ink-2); font-size: .88rem; }
.meta .ico { width: 15px; height: 15px; }
.empty { color: var(--ink-2); text-align: center; padding: 28px 8px; }
.more { text-align: center; margin-top: 24px; }
.more a { color: var(--ink-2); }

.back { display: inline-flex; align-items: center; gap: 2px; text-decoration: none; font-weight: 600; color: var(--ink-2); margin-bottom: 8px; }
.back .ico { width: 20px; height: 20px; }
.event-detail { background: var(--bg); border-radius: var(--radius); padding: 20px; border: 1px solid var(--line); }
.event-detail.p1 { border-top: 6px solid var(--green); }
.event-detail h1 { margin: 12px 0 6px; }
.theme { font-size: 1.05rem; color: var(--ink-2); margin: 0 0 16px; }
.facts { margin: 0 0 16px; display: flex; flex-direction: column; gap: 10px; }
.facts div { display: flex; align-items: center; gap: 12px; }
.facts dt { color: var(--green-ink); }
.facts dd { margin: 0; font-weight: 600; }
.prose { border-top: 1px solid var(--line); padding-top: 12px; margin-bottom: 20px; }
.prose p { margin: 0 0 12px; }

/* Annuaire et bureau */
.search { position: relative; margin-bottom: 8px; }
.search .ico { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--ink-2); }
.search input {
  width: 100%; height: 50px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg);
  padding: 0 14px 0 46px; font: inherit; font-size: 16px;
}
.count { color: var(--ink-2); font-size: .85rem; margin: 4px 0 12px; }
.people { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.person {
  display: flex; align-items: center; gap: 12px; background: var(--bg); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 12px;
}
.person[hidden] { display: none; }
.avatar { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; flex: none; background: var(--green-soft); }
.avatar-initials { display: grid; place-items: center; font-weight: 700; color: var(--green-ink); }
.person-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.person-body strong { font-size: 1rem; }
.person-body .meta { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.caps { text-transform: uppercase; }
.actions { display: flex; gap: 8px; flex: none; }
.role { font-size: .74rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--green-ink); }
.bureau .lead { border-color: var(--green); background: linear-gradient(0deg, var(--bg), var(--bg)) padding-box, var(--green); }
.bureau .lead .avatar { width: 68px; height: 68px; }

/* Ressources */
.res-group.depth-1, .res-group.depth-2 { margin-left: 12px; }
.res-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.res {
  display: flex; align-items: center; gap: 12px; padding: 14px; background: var(--bg);
  border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none;
}
.res-ico { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--green-soft); color: var(--green-ink); flex: none; }
.res-body { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.res > .ico { color: var(--ink-2); width: 18px; }

/* Écrans d'accès, hors ligne */
.locked { text-align: center; padding: 48px 8px; max-width: 420px; margin: 0 auto; }
.locked p { color: var(--ink-2); }
.offline-bar {
  position: fixed; left: 12px; right: 12px; bottom: calc(var(--tabbar) + var(--safe-b) + 10px); z-index: 30;
  background: var(--ink); color: #fff; padding: 10px 14px; border-radius: 10px; font-size: .88rem; text-align: center;
}

/* Desktop : onglets en haut, grille élargie */
@media (min-width: 900px) {
  body { padding-bottom: 32px; }
  .topbar { padding: 12px 32px; }
  .tabs { position: static; display: flex; gap: 4px; height: auto; border: 0; padding: 0; background: none; }
  .tabs a { flex-direction: row; font-size: .92rem; padding: 10px 14px; border-radius: 10px; gap: 8px; }
  .tabs a[aria-current="page"] { background: var(--green-soft); }
  .tabs a[aria-current="page"] .ico { background: none; padding: 0; width: 22px; height: 22px; }
  .main { max-width: 960px; padding: 32px; }
  .tiles { grid-template-columns: repeat(4, 1fr); }
  .people:not(.bureau), .res-list { display: grid; grid-template-columns: 1fr 1fr; }
  .offline-bar { bottom: 16px; max-width: 480px; margin: 0 auto; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
