@import url('https://fonts.googleapis.com/css2?family=Shippori+Mincho:wght@500;600;700;800&family=Zen+Maru+Gothic:wght@400;500;700&family=Cormorant+Garamond:ital,wght@1,500;1,600&family=Fira+Code:wght@500&display=swap');

/* =========================================================================
   Mante d'Émeraude — même ossature que le site de la Brigade Scientifique
   (cartes, liserés dorés, typographies), recolorée en émeraude profond.
   Chaque grade a sa couleur propre (--g), définie dans assets/effectif.js.
   ========================================================================= */
:root,
:root[data-theme="sombre"] {
  --bg: #06130E;
  --bg-2: #0A1D16;
  --bg-glow: rgba(16, 185, 129, 0.16);
  --card: #0D221A;
  --card-2: #11291F;
  --line: #1C3B2F;
  --line-soft: rgba(52, 211, 153, 0.10);
  --ink: #E6F4EC;
  --ink-soft: #93B5A5;
  --emerald: #34D399;
  --emerald-deep: #10B981;
  --gold: #D9B36A;
  --gold-soft: rgba(217, 179, 106, 0.35);
  --ok: #4ADE80;
  --warn: #FBBF24;
  --off: #F87171;
  --shadow: 0 10px 34px rgba(0, 0, 0, 0.45);
  --topbar: rgba(6, 19, 14, 0.72);
  --hero: linear-gradient(135deg, #04110C 0%, #0B2A1F 55%, #0F5A40 100%);
  --mix-base: #0D221A;
  color-scheme: dark;
}

:root[data-theme="clair"] {
  --bg: #EEF6F1;
  --bg-2: #DDEFE5;
  --bg-glow: rgba(16, 185, 129, 0.14);
  --card: #FFFFFF;
  --card-2: #F5FBF8;
  --line: #C8E3D5;
  --line-soft: rgba(6, 95, 70, 0.08);
  --ink: #102A20;
  --ink-soft: #4A6A5C;
  --emerald: #059669;
  --emerald-deep: #047857;
  --gold: #A27A32;
  --gold-soft: rgba(162, 122, 50, 0.35);
  --ok: #15803D;
  --warn: #B45309;
  --off: #B91C1C;
  --shadow: 0 10px 30px rgba(6, 60, 40, 0.10);
  --topbar: rgba(255, 255, 255, 0.75);
  --hero: linear-gradient(135deg, #062A1E 0%, #0B4632 55%, #0E7A55 100%);
  --mix-base: #FFFFFF;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 84px; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: 'Zen Maru Gothic', system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  background:
    radial-gradient(ellipse 80% 50% at 50% -10%, var(--bg-glow), transparent 70%),
    linear-gradient(var(--bg), var(--bg-2));
  background-attachment: fixed;
}
h1, h2, h3, h4 { font-family: 'Shippori Mincho', serif; margin: 0; line-height: 1.2; }
a { color: inherit; }
.muted { color: var(--ink-soft); }
code { font-family: 'Fira Code', monospace; font-size: 12.5px; }
.eyebrow {
  display: inline-block;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--gold);
}

/* ---------- Barre du haut ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 20px;
  padding: 10px clamp(16px, 4vw, 40px);
  background: var(--topbar);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--gold-soft);
}
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.brand-logo { width: 34px; height: auto; filter: drop-shadow(0 2px 6px rgba(0,0,0,.35)); }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; white-space: nowrap; }
.brand-text strong { font-family: 'Shippori Mincho', serif; font-size: 17px; letter-spacing: .02em; }
.brand-text small { color: var(--ink-soft); font-size: 12px; }
.topnav { display: flex; align-items: center; gap: 2px; margin-left: auto; flex-wrap: nowrap; white-space: nowrap; }
.topnav a {
  text-decoration: none; font-size: 13.5px; font-weight: 500;
  padding: 7px 12px; border-radius: 999px; color: var(--ink-soft);
  transition: background .15s, color .15s;
}
.topnav a:hover { background: var(--line-soft); color: var(--ink); }
.theme-btn {
  display: grid; place-items: center;
  width: 38px; height: 38px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--card); color: var(--gold);
  cursor: pointer;
}
.theme-btn:hover { border-color: var(--gold); }
:root[data-theme="clair"] .ico-moon, :root:not([data-theme="clair"]) .ico-sun { display: none; }

/* ---------- Page ---------- */
.page { max-width: 1240px; margin: 0 auto; padding: 28px clamp(16px, 4vw, 40px) 60px; }

/* ---------- Héros ---------- */
.hero {
  position: relative; overflow: hidden;
  display: grid; grid-template-columns: auto 1fr; gap: clamp(20px, 4vw, 48px); align-items: center;
  padding: clamp(24px, 4vw, 44px);
  border-radius: 22px;
  background: var(--hero);
  color: #F0FFF7;
  border: 1px solid rgba(217, 179, 106, .35);
  box-shadow: var(--shadow);
}
.hero::after {
  content: ""; position: absolute; inset: 10px; border-radius: 16px; pointer-events: none;
  border: 1px solid rgba(217, 179, 106, .18);
}
.hero-glow {
  position: absolute; width: 420px; height: 420px; left: -80px; top: -120px; border-radius: 50%;
  background: radial-gradient(circle, rgba(52, 211, 153, .35), transparent 65%);
  pointer-events: none;
}
.hero-emblem { position: relative; }
.hero-emblem img {
  display: block; width: clamp(96px, 14vw, 150px); height: auto;
  filter: drop-shadow(0 12px 24px rgba(0,0,0,.5)) drop-shadow(0 0 22px rgba(52,211,153,.25));
  animation: flotte 6s ease-in-out infinite;
}
@keyframes flotte { 50% { transform: translateY(-6px); } }
.hero-body { position: relative; }
.hero .eyebrow { color: #E9C987; }
.hero-title { font-size: clamp(28px, 4.6vw, 46px); font-weight: 800; margin: 6px 0 8px; }
.hero-title em {
  font-style: normal;
  background: linear-gradient(90deg, #6EE7B7, #E9C987);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero-devise { font-family: 'Cormorant Garamond', serif; font-style: italic; font-size: 20px; margin: 0 0 22px; color: #CFEBDD; }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; max-width: 480px; }
.stat {
  padding: 12px 14px; border-radius: 14px;
  background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.12);
}
.stat strong { display: block; font-family: 'Shippori Mincho', serif; font-size: 28px; line-height: 1; }
.stat span { font-size: 12.5px; color: #B9D8C9; }
.stat.ok strong { color: #86EFAC; }
.stat.off strong { color: #FCA5A5; }
.stat.gold strong { color: #E9C987; }

/* ---------- Blocs génériques ---------- */
.ladder-card, .poles-card, .filters {
  margin-top: 22px;
  background: var(--card);
  border: 1px solid var(--line);
  border-top: 3px solid var(--gold);
  border-radius: 18px;
  box-shadow: var(--shadow);
}
.ladder-card, .poles-card { padding: 22px; }
.section-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.section-head h2 { font-size: 22px; margin-top: 2px; }
.section-head p { margin: 0; font-size: 13px; }

/* ---------- Médaillon de grade ---------- */
.medaillon {
  flex: none; display: grid; place-items: center;
  width: 40px; height: 40px; border-radius: 50%;
  color: var(--g);
  background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--g) 30%, var(--mix-base)), color-mix(in srgb, var(--g) 10%, var(--mix-base)));
  border: 2px solid var(--g);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--g) 18%, transparent), 0 0 18px color-mix(in srgb, var(--g) 30%, transparent);
}
.medaillon-sm { width: 30px; height: 30px; box-shadow: none; border-width: 1.5px; }

/* ---------- Échelle des grades ---------- */
.ladder { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.ladder a {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px; border-radius: 12px; text-decoration: none;
  background: color-mix(in srgb, var(--g) 7%, var(--card));
  border: 1px solid color-mix(in srgb, var(--g) 30%, var(--line));
  transition: transform .15s, border-color .15s, background .15s;
}
.ladder a:hover { transform: translateY(-2px); border-color: var(--g); background: color-mix(in srgb, var(--g) 14%, var(--card)); }
.ladder .medaillon { width: 34px; height: 34px; }
.ladder-txt { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.ladder-txt b { font-family: 'Shippori Mincho', serif; color: var(--g); font-size: 15px; }
.ladder-txt small { color: var(--ink-soft); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ladder-nb {
  margin-left: auto; min-width: 26px; text-align: center;
  font-weight: 700; font-size: 12.5px; padding: 2px 8px; border-radius: 999px;
  background: color-mix(in srgb, var(--g) 20%, transparent); color: var(--ink);
}

/* ---------- Filtres ---------- */
.filters {
  position: sticky; top: 64px; z-index: 10;
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  padding: 12px 14px;
  border-top-width: 1px; border-top-color: var(--line);
}
.search-field {
  flex: 1 1 220px; display: flex; align-items: center; gap: 8px;
  padding: 0 12px; height: 40px; border-radius: 10px;
  background: var(--card-2); border: 1px solid var(--line); color: var(--ink-soft);
}
.search-field:focus-within { border-color: var(--emerald); }
.search-field input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--ink); font: inherit; }
.filters select {
  height: 40px; padding: 0 30px 0 12px; border-radius: 10px; font: inherit; font-size: 14px;
  color: var(--ink); background: var(--card-2); border: 1px solid var(--line); cursor: pointer;
  max-width: 100%;
}
.filters select:focus { outline: 2px solid var(--emerald); outline-offset: 1px; }
.switch { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--ink-soft); cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch-track { position: relative; width: 36px; height: 20px; border-radius: 999px; background: var(--line); transition: background .2s; }
.switch-track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: transform .2s; }
.switch input:checked + .switch-track { background: var(--emerald-deep); }
.switch input:checked + .switch-track::after { transform: translateX(16px); }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--emerald); outline-offset: 2px; }
.btn-ghost {
  height: 40px; padding: 0 14px; border-radius: 10px; font: inherit; font-size: 14px; cursor: pointer;
  background: transparent; color: var(--ink-soft); border: 1px dashed var(--line);
}
.btn-ghost:hover { color: var(--ink); border-color: var(--gold); }

/* ---------- Pôles ---------- */
.poles-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.pole {
  display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 12px; cursor: pointer;
  font: inherit; color: var(--ink); text-align: left;
  background: color-mix(in srgb, var(--c) 7%, var(--card));
  border: 1px solid color-mix(in srgb, var(--c) 28%, var(--line));
  transition: transform .15s, border-color .15s;
}
.pole:hover { transform: translateY(-2px); border-color: var(--c); }
.pole.actif { border-color: var(--c); box-shadow: 0 0 0 2px color-mix(in srgb, var(--c) 40%, transparent); }
.pole-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--c); box-shadow: 0 0 10px var(--c); flex: none; }
:root[data-theme="clair"] .pole[data-pole="religion"] { --c: #8A7A55 !important; }
.pole-nom { font-weight: 700; }
.pole-nb { margin-left: auto; font-family: 'Shippori Mincho', serif; font-weight: 700; font-size: 18px; color: var(--ink-soft); }

/* ---------- Paliers & grades ---------- */
.palier { margin-top: 44px; }
.palier-head { display: flex; align-items: center; gap: 16px; margin-bottom: 18px; }
.palier-head::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, var(--gold-soft), transparent); }
.palier-num {
  position: relative; display: grid; place-items: center; width: 52px; height: 52px; flex: none;
  font-family: 'Shippori Mincho', serif; font-weight: 800; font-size: 17px; color: var(--gold); line-height: 1;
}
.palier-num::before {
  content: ""; position: absolute; inset: 7px; border-radius: 7px; transform: rotate(45deg);
  border: 1.5px solid var(--gold); background: color-mix(in srgb, var(--gold) 10%, transparent);
}
.palier-num b { position: relative; }
.palier-head h2 { font-size: clamp(22px, 3vw, 28px); }
.palier-head p { margin: 2px 0 0; color: var(--ink-soft); font-size: 13.5px; }

.grade-block {
  margin-bottom: 18px; padding: 18px;
  border-radius: 18px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--g) 9%, var(--card)), var(--card) 120px);
  border: 1px solid color-mix(in srgb, var(--g) 32%, var(--line));
  border-left: 4px solid var(--g);
  box-shadow: var(--shadow);
}
.grade-head { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.grade-head h3 { font-size: 19px; color: var(--g); }
:root[data-theme="clair"] .grade-head h3,
:root[data-theme="clair"] .ladder-txt b { color: color-mix(in srgb, var(--g) 55%, #102A20); }
.grade-head p { margin: 2px 0 0; font-size: 13px; color: var(--ink-soft); }
.grade-count {
  margin-left: auto; flex: none;
  font-family: 'Shippori Mincho', serif; font-size: 24px; font-weight: 800; color: var(--ink);
}
.grade-count small { font-size: 14px; color: var(--ink-soft); font-weight: 600; }
.grade-vide { margin: 0; color: var(--ink-soft); font-style: italic; font-size: 14px; }

/* ---------- Cartes membres ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 12px; }
.cards-vedette { grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); }
.m-card {
  position: relative; display: flex; flex-direction: column; gap: 12px;
  padding: 14px 16px; border-radius: 14px;
  background: var(--card-2);
  border: 1px solid var(--line);
  border-top: 3px solid var(--g);
  transition: transform .15s, box-shadow .15s, border-color .15s;
}
.m-card:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--g) 50%, var(--line)); box-shadow: 0 10px 26px color-mix(in srgb, var(--g) 16%, transparent); }
.m-card-vedette { padding: 18px 20px; background: linear-gradient(135deg, color-mix(in srgb, var(--g) 12%, var(--card-2)), var(--card-2)); }
.m-card-vedette .avatar { width: 52px; height: 52px; font-size: 18px; }
.m-card-vedette h4 { font-size: 19px; }

.m-head { display: flex; align-items: center; gap: 12px; }
.avatar {
  flex: none; display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%;
  font-family: 'Shippori Mincho', serif; font-weight: 800; font-size: 15px; color: #fff;
  background: linear-gradient(135deg, var(--g), color-mix(in srgb, var(--g) 45%, #000));
  box-shadow: 0 0 0 2px var(--card-2), 0 0 0 3.5px var(--g);
  text-shadow: 0 1px 2px rgba(0,0,0,.4);
}
.m-id { min-width: 0; }
.m-id h4 { font-size: 16.5px; overflow-wrap: anywhere; }
.m-grade { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 700; color: var(--g); margin-top: 2px; }
:root[data-theme="clair"] .m-grade { color: color-mix(in srgb, var(--g) 55%, #102A20); }

.presence {
  flex: none;
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11.5px; font-weight: 700; padding: 4px 9px; border-radius: 999px;
  letter-spacing: 0; text-transform: none;
  color: var(--s); background: color-mix(in srgb, var(--s) 13%, transparent);
  border: 1px solid color-mix(in srgb, var(--s) 35%, transparent);
}
.presence i { width: 7px; height: 7px; border-radius: 50%; background: var(--s); }
.presence.ok { --s: var(--ok); }
.presence.ok i { box-shadow: 0 0 0 0 var(--ok); animation: pouls 2.2s infinite; }
.presence.warn { --s: var(--warn); }
.presence.off { --s: var(--off); }
@keyframes pouls { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--ok) 60%, transparent); } 70%, 100% { box-shadow: 0 0 0 6px transparent; } }

.m-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; margin: 0; }
.m-meta .full { grid-column: 1 / -1; }
.m-meta dt { font-size: 10.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-soft); margin-bottom: 2px; }
.m-meta dd { margin: 0; font-size: 14px; }
.chips { display: flex; flex-wrap: wrap; gap: 5px; }
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 999px;
  color: var(--ink);
  background: color-mix(in srgb, var(--c) 16%, transparent);
  border: 1px solid color-mix(in srgb, var(--c) 45%, transparent);
}
.chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--c); }
.chip-section { border-radius: 6px; }

.m-note { margin: 0; font-size: 13px; color: var(--ink-soft); font-style: italic; padding-left: 10px; border-left: 2px solid var(--gold-soft); }
.m-foot {
  display: flex; align-items: center; gap: 8px;
  margin-top: auto; padding-top: 10px; border-top: 1px dashed var(--line);
  font-size: 11.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-soft);
}
.m-blames { margin-left: auto; }
.pips { display: inline-flex; gap: 6px; }
.pips i { width: 11px; height: 11px; border-radius: 3px; transform: rotate(45deg); border: 1.5px solid color-mix(in srgb, var(--ink-soft) 55%, transparent); }
.pips i.on { background: var(--off); border-color: var(--off); box-shadow: 0 0 8px color-mix(in srgb, var(--off) 55%, transparent); }

.m-vacant {
  flex-direction: row; align-items: center; justify-content: flex-start; gap: 12px;
  min-height: 64px; padding: 12px 16px;
  background: transparent; border: 1.5px dashed color-mix(in srgb, var(--g) 35%, var(--line)); border-top-width: 1.5px;
  color: var(--ink-soft); opacity: .8;
}
.m-vacant:hover { transform: none; box-shadow: none; opacity: 1; }
.m-vacant span { font-style: italic; }
.m-vacant small { margin-left: auto; font-weight: 700; color: var(--g); }

.empty { text-align: center; color: var(--ink-soft); padding: 40px 0; font-style: italic; }

/* ---------- Membres en lignes ---------- */
.rows { display: flex; flex-direction: column; gap: 8px; }
.m-row {
  position: relative;
  display: grid;
  grid-template-columns: minmax(190px, 1.7fr) minmax(0, .7fr) minmax(0, .8fr) minmax(0, 1fr) minmax(0, 1.5fr) minmax(0, .95fr) auto;
  align-items: center; gap: 12px;
  padding: 12px 16px 12px 18px; border-radius: 14px;
  background: var(--card-2);
  border: 1px solid var(--line);
  border-left: 3px solid var(--g);
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.m-row-gestion { grid-template-columns: minmax(190px, 1.7fr) minmax(0, .7fr) minmax(0, .8fr) minmax(0, 1fr) minmax(0, 1.5fr) minmax(0, .95fr) auto auto; }
.m-row:hover {
  border-color: color-mix(in srgb, var(--g) 50%, var(--line));
  border-left-color: var(--g);
  background: color-mix(in srgb, var(--g) 5%, var(--card-2));
  box-shadow: 0 8px 22px color-mix(in srgb, var(--g) 12%, transparent);
}
.m-row-vedette { padding-top: 16px; padding-bottom: 16px; background: linear-gradient(90deg, color-mix(in srgb, var(--g) 12%, var(--card-2)), var(--card-2) 60%); }
.m-row-vedette .avatar { width: 50px; height: 50px; font-size: 17px; }
.m-row-vedette h4 { font-size: 18px; }

.m-who { display: flex; align-items: center; gap: 12px; min-width: 0; }
.m-who .m-id { display: flex; flex-direction: column; min-width: 0; }
.m-who h4 { font-size: 16px; overflow-wrap: anywhere; }
.m-who .m-note { margin-top: 3px; font-size: 12.5px; font-style: italic; color: var(--ink-soft); border: 0; padding: 0; }

.m-cell { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.m-lbl { font-size: 10.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-soft); }
.m-val { font-size: 14px; min-width: 0; }
.m-val .presence { white-space: nowrap; }
.m-val .chips { display: flex; flex-wrap: wrap; gap: 5px; }
.m-row .m-actions { position: static; opacity: 1; justify-content: flex-end; }

@media (max-width: 1100px) {
  .m-row, .m-row-gestion { grid-template-columns: repeat(5, minmax(0, 1fr)); row-gap: 12px; }
  .m-who { grid-column: 1 / -1; }
  .m-cell-poles { grid-column: 1 / -1; order: 1; }
  .m-row .m-actions { position: absolute; top: 12px; right: 12px; }
  .m-row-gestion .m-who { padding-right: 76px; }
}
@media (max-width: 560px) {
  .m-row, .m-row-gestion { grid-template-columns: 1fr 1fr; }
}

/* ---------- Membre à 3 / 3 blâmes : ligne entièrement rouge ---------- */
.m-row.m-row-blame3,
.m-row.m-row-blame3:hover {
  --ink: #FFF1F1;
  --ink-soft: rgba(255, 235, 235, .78);
  --off: #FFFFFF;
  color: var(--ink);
  background: linear-gradient(90deg, #C81E1E, #8E1414);
  border-color: #FF5A5A;
  border-left: 6px solid #FFD2D2;
  box-shadow: 0 0 0 1px rgba(255, 90, 90, .35), 0 10px 28px rgba(200, 30, 30, .35);
}
.m-row-blame3 .m-grade { color: #FFE1E1 !important; }
.m-row-blame3 .chip { color: #FFFFFF; background: rgba(0, 0, 0, .22); border-color: rgba(255, 255, 255, .35); }
.m-row-blame3 .presence { color: #FFFFFF; background: rgba(0, 0, 0, .22); border-color: rgba(255, 255, 255, .35); --s: #FFFFFF; }
.m-row-blame3 .pips i { border-color: #FFFFFF; }
.m-row-blame3 .pips i.on { background: #FFFFFF; box-shadow: 0 0 10px rgba(255, 255, 255, .8); }
.m-row-blame3 .icon-btn { background: rgba(0, 0, 0, .25); color: #FFFFFF; border-color: rgba(255, 255, 255, .35); }
.m-row-blame3 .avatar { box-shadow: 0 0 0 2px #8E1414, 0 0 0 3.5px #FFFFFF; }
.badge-blame3 {
  align-self: flex-start; margin-top: 5px;
  font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase;
  padding: 3px 8px; border-radius: 6px;
  color: #8E1414; background: #FFFFFF;
  animation: alerte-blame 1.6s ease-in-out infinite;
}
@keyframes alerte-blame { 50% { opacity: .65; } }

/* ---------- Lien « Sections » de la barre du haut ---------- */
.topnav a.topnav-sections {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--gold); border: 1px solid var(--gold-soft); margin-right: 6px;
}
.topnav a.topnav-sections:hover, .topnav a.topnav-sections.actif { color: var(--ink); border-color: var(--gold); background: color-mix(in srgb, var(--gold) 12%, transparent); }

/* ---------- Page Sections ---------- */
.couleur-champ { display: flex; flex-direction: column; gap: 8px; }
.couleur-titre { font-size: 13px; font-weight: 700; color: var(--ink-soft); }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch { position: relative; cursor: pointer; }
.swatch input[type="radio"] { position: absolute; opacity: 0; width: 1px; height: 1px; }
.swatch span {
  display: block; width: 30px; height: 30px; border-radius: 50%;
  background: var(--c); border: 2px solid var(--card); box-shadow: 0 0 0 1px var(--line);
  transition: transform .15s, box-shadow .15s;
}
.swatch:hover span { transform: scale(1.08); }
.swatch input:checked + span { box-shadow: 0 0 0 2px var(--card), 0 0 0 4px var(--ink); }
.swatch input:focus-visible + span { outline: 2px solid var(--gold); outline-offset: 3px; }
.swatch-libre input[type="color"] {
  width: 30px; height: 30px; padding: 0; border: 1px dashed var(--ink-soft); border-radius: 50%;
  background: conic-gradient(#E5484D, #FACC15, #34D399, #3B82F6, #A78BFA, #E5484D); cursor: pointer;
}
.swatch-libre input[type="color"]::-webkit-color-swatch-wrapper { padding: 3px; }
.swatch-libre input[type="color"]::-webkit-color-swatch { border: 0; border-radius: 50%; }
.swatch-libre input[type="radio"]:checked ~ input[type="color"] { box-shadow: 0 0 0 2px var(--card), 0 0 0 4px var(--ink); }

.section-list { list-style: none; margin: 14px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.section-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; border-radius: 12px;
  background: color-mix(in srgb, var(--c) 7%, var(--card-2));
  border: 1px solid color-mix(in srgb, var(--c) 30%, var(--line));
  border-left: 4px solid var(--c);
}
.section-edit { flex: 1; display: flex; align-items: center; gap: 8px; min-width: 0; margin: 0; }
.section-couleur {
  flex: none; width: 34px; height: 34px; padding: 0; border: 1px solid var(--line); border-radius: 8px;
  background: none; cursor: pointer;
}
.section-couleur::-webkit-color-swatch-wrapper { padding: 3px; }
.section-couleur::-webkit-color-swatch { border: 0; border-radius: 5px; }
.section-nom {
  flex: 1; min-width: 0; height: 34px; padding: 0 10px; border-radius: 8px; font: inherit; font-weight: 700; font-size: 14px;
  color: var(--ink); background: transparent; border: 1px solid transparent;
}
.section-nom:hover { border-color: var(--line); }
.section-nom:focus { outline: none; border-color: var(--emerald); background: var(--card-2); }
.section-nb { flex: none; font-size: 12px; color: var(--ink-soft); white-space: nowrap; }

@media (max-width: 640px) {
  .section-item { flex-wrap: wrap; }
  .section-edit { flex-wrap: wrap; flex-basis: 100%; }
  .section-nom { flex-basis: calc(100% - 42px); }
}

/* ---------- Pied de page ---------- */
.footer {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 30px 16px 40px; border-top: 1px solid var(--gold-soft); text-align: center; font-size: 13.5px;
}
.footer p { margin: 0; }
.footer img { width: 28px; height: auto; opacity: .85; margin-bottom: 4px; }

/* ---------- Barre du haut : compte ---------- */
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.topnav a.actif { color: var(--ink); background: var(--line-soft); }
.user-pill {
  display: inline-flex; align-items: center; gap: 7px; max-width: 200px;
  padding: 6px 12px; border-radius: 999px; font-size: 13px; font-weight: 700; text-decoration: none;
  background: var(--card); border: 1px solid var(--line);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.user-pill:hover { border-color: var(--emerald); }
.user-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); flex: none; }
.inline-form { display: inline; margin: 0; }

/* ---------- Boutons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 42px; padding: 0 18px; border-radius: 11px; border: 1px solid transparent;
  font: inherit; font-weight: 700; font-size: 14.5px; cursor: pointer; text-decoration: none;
  transition: transform .15s, box-shadow .15s, background .15s;
}
.btn-primary {
  color: #04140D;
  background: linear-gradient(135deg, #6EE7B7, #10B981);
  box-shadow: 0 6px 18px rgba(16, 185, 129, .3);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 10px 24px rgba(16, 185, 129, .4); }
.btn-primary:focus-visible, .btn-ghost:focus-visible, .icon-btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.btn-block { width: 100%; }
.btn-ghost { display: inline-flex; align-items: center; text-decoration: none; }
.btn-sm { height: 34px; padding: 0 12px; font-size: 13px; }
.btn-danger { color: var(--off); border-color: color-mix(in srgb, var(--off) 40%, transparent); }
.btn-danger:hover { color: var(--off); border-color: var(--off); background: color-mix(in srgb, var(--off) 10%, transparent); }
.hero-actions { margin-top: 20px; }
.icon-btn {
  display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px;
  background: var(--card-2); color: var(--ink-soft); border: 1px solid var(--line); cursor: pointer; font-size: 15px;
}
.icon-btn:hover { color: var(--ink); border-color: var(--emerald); }
.icon-btn-sm { width: 30px; height: 30px; border-radius: 8px; }
.icon-btn-danger:hover { color: var(--off); border-color: var(--off); }

/* ---------- Actions sur une carte membre ---------- */
.m-actions {
  position: absolute; top: 10px; right: 10px; display: flex; gap: 6px;
  opacity: 0; transition: opacity .15s;
}
.m-card:hover .m-actions, .m-card:focus-within .m-actions { opacity: 1; }
@media (hover: none) { .m-actions { opacity: 1; } }
.m-card-gestion .m-head { padding-right: 70px; }

/* ---------- Alertes ---------- */
.alert {
  margin-bottom: 16px; padding: 12px 16px; border-radius: 12px; font-size: 14px;
  border: 1px solid; border-left-width: 4px;
}
.alert-succes { color: var(--ink); background: color-mix(in srgb, var(--ok) 12%, var(--card)); border-color: color-mix(in srgb, var(--ok) 45%, transparent); }
.alert-erreur { color: var(--ink); background: color-mix(in srgb, var(--off) 12%, var(--card)); border-color: color-mix(in srgb, var(--off) 45%, transparent); }
.alert a { color: var(--gold); font-weight: 700; }

/* ---------- Formulaires ---------- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
.form-grid .full { grid-column: 1 / -1; }
.form-stack { display: flex; flex-direction: column; gap: 14px; margin-top: 18px; }
.form-grid > label, .form-stack label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 700; color: var(--ink-soft); }
.aide { font-weight: 400; font-size: 12px; color: var(--ink-soft); opacity: .85; }
fieldset { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px 14px; margin: 0; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
legend { padding: 0 6px; font-size: 13px; font-weight: 700; color: var(--ink-soft); }
.form-grid input, .form-grid select, .form-stack input, .form-stack select, .panel select, .mdp-form input {
  height: 42px; padding: 0 12px; border-radius: 10px; font: inherit; font-size: 14.5px; font-weight: 400;
  color: var(--ink); background: var(--card-2); border: 1px solid var(--line); width: 100%; min-width: 0;
}
.form-grid input:focus, .form-grid select:focus, .form-stack input:focus, .form-stack select:focus, .panel select:focus, .mdp-form input:focus {
  outline: none; border-color: var(--emerald); box-shadow: 0 0 0 3px color-mix(in srgb, var(--emerald) 22%, transparent);
}
.checkbox-row { display: flex; flex-wrap: wrap; gap: 8px; }
.checkbox-pill { position: relative; cursor: pointer; }
.checkbox-pill input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.checkbox-pill span {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 999px;
  font-size: 13px; font-weight: 700; color: var(--ink-soft);
  border: 1px solid var(--line); background: var(--card-2); transition: all .15s;
}
.checkbox-pill span::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--c); opacity: .5; }
.checkbox-pill input:checked + span { color: var(--ink); border-color: var(--c); background: color-mix(in srgb, var(--c) 16%, var(--card-2)); }
.checkbox-pill input:checked + span::before { opacity: 1; box-shadow: 0 0 8px var(--c); }
.checkbox-pill input:focus-visible + span { outline: 2px solid var(--gold); outline-offset: 2px; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 4px; }
.form-actions .btn-ghost { height: 42px; }

/* ---------- Fenêtres (modales) ---------- */
.modal {
  position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px;
  background: rgba(2, 10, 7, .7); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
}
.modal[hidden] { display: none; }
.modal-content {
  width: min(640px, 100%); max-height: calc(100vh - 32px); overflow-y: auto;
  padding: 22px; border-radius: 18px;
  background: var(--card); border: 1px solid var(--line); border-top: 3px solid var(--gold);
  box-shadow: 0 30px 80px rgba(0, 0, 0, .55);
  animation: monte .2s ease;
}
@keyframes monte { from { transform: translateY(12px); opacity: 0; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.modal-head h2 { font-size: 21px; }
body.modal-ouvert { overflow: hidden; }

/* ---------- Connexion / Mon compte ---------- */
.auth-card {
  max-width: 440px; margin: 30px auto; padding: 30px 28px; text-align: center;
  background: var(--card); border: 1px solid var(--line); border-top: 3px solid var(--gold);
  border-radius: 20px; box-shadow: var(--shadow);
}
.auth-card h1 { font-size: 28px; margin: 4px 0 6px; }
.auth-card .form-stack { text-align: left; }
.auth-card .alert { margin-top: 16px; text-align: left; }
.auth-logo { display: block; width: 80px; height: auto; margin: 0 auto 10px; filter: drop-shadow(0 8px 16px rgba(0,0,0,.4)); }
.auth-hint { font-size: 13px; color: var(--ink-soft); margin: 16px 0 0; }
.auth-retour { display: inline-block; margin-top: 18px; font-size: 13.5px; color: var(--ink-soft); text-decoration: none; }
.auth-retour:hover { color: var(--ink); }

/* ---------- Administration des comptes ---------- */
.page-header { margin: 6px 0 22px; }
.page-header h1 { font-size: clamp(26px, 4vw, 34px); margin: 4px 0; }
.page-header p { margin: 0; }
.admin-grid { display: grid; grid-template-columns: minmax(280px, 360px) 1fr; gap: 18px; align-items: start; }
.panel {
  padding: 22px; border-radius: 18px; min-width: 0;
  background: var(--card); border: 1px solid var(--line); border-top: 3px solid var(--gold); box-shadow: var(--shadow);
}
.panel h2 { font-size: 20px; }
.panel .form-stack { margin-top: 14px; }
.table-wrap { overflow-x: auto; margin-top: 14px; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-soft); padding: 8px 10px; border-bottom: 1px solid var(--line); }
.table td { padding: 12px 10px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.table select { height: 36px; width: auto; }
.mdp-form { display: flex; gap: 6px; }
.mdp-form input { height: 34px; width: 170px; font-size: 13px; }
.tag-moi { font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 999px; background: color-mix(in srgb, var(--emerald) 20%, transparent); color: var(--emerald); }

/* ---------- Responsive ---------- */
@media (max-width: 1380px) {
  /* Les ancres des paliers disparaissent ; Sections / Comptes / Effectif restent accessibles. */
  .topnav a[href^="#"] { display: none; }
}
@media (max-width: 560px) {
  .topnav a.topnav-sections { margin-right: 0; }
  .topnav a:not(.topnav-sections) { display: none; }
}
@media (max-width: 860px) {
  .topbar-actions { margin-left: auto; }
  .admin-grid { grid-template-columns: 1fr; }
  .filters { top: 60px; position: static; }
}
@media (max-width: 640px) {
  .hero { grid-template-columns: 1fr; text-align: center; justify-items: center; }
  .stats { margin: 0 auto; }
  .cards, .cards-vedette { grid-template-columns: 1fr; }
  .filters select, .btn-ghost { flex: 1 1 calc(50% - 5px); }
  .grade-head { flex-wrap: wrap; }
  .ladder { grid-template-columns: 1fr 1fr; }
  .ladder-txt small { display: none; }
  .form-grid { grid-template-columns: 1fr; }
  .brand-text small, .user-pill { display: none; }
  .modal { padding: 0; place-items: end stretch; }
  .modal-content { border-radius: 18px 18px 0 0; max-height: 92vh; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}
@media print {
  .topbar, .filters, .theme-btn { display: none; }
  body { background: #fff; }
}
