/* JREP – application générale du Pôle Jeunesse */
.jrep-suite {
  --j-ink: #1b2230;
  --j-ink-2: #4a5466;
  --j-ink-3: #7b8597;
  --j-line: #e3e7ee;
  --j-bg: #ffffff;
  --j-bg-2: #f5f7fa;
  --j-accent: #0f5c8c;
  --j-good: #1d7a4b;
  --j-warn: #a15c00;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--j-ink);
  font-size: 14px;
  line-height: 1.45;
  margin: 1em 0 2em;
}
.jrep-suite, .jrep-suite *, .jrep-suite *::before, .jrep-suite *::after { box-sizing: border-box; }
.jrep-suite h2, .jrep-suite h3, .jrep-suite h4 { font-family: inherit; letter-spacing: normal; text-transform: none; }
.jrep-suite.jrep-bleed { padding: 0 16px; }
.jrep-acces { background: var(--j-bg-2); border: 1px solid var(--j-line); border-radius: 12px; padding: 20px; }

/* En-tête */
.jrep-head {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px;
  background: var(--j-bg); border: 1px solid var(--j-line); border-radius: 14px;
  padding: 12px 18px; margin-bottom: 16px;
}
.jrep-logo { height: 54px; width: auto; display: block; }
.jrep-titre { min-width: 0; flex: 1 1 260px; }
.jrep-titre h2 { font-size: 20px; margin: 0; line-height: 1.2; color: var(--j-ink); font-weight: 700; }
.jrep-titre p { margin: 3px 0 0; color: var(--j-ink-3); font-size: 13px; }
.jrep-live { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--j-ink-3); white-space: nowrap; }
.jrep-live i { width: 8px; height: 8px; border-radius: 50%; background: var(--j-good); box-shadow: 0 0 0 3px rgba(29,122,75,.15); }
.jrep-live.is-busy i { background: var(--j-warn); box-shadow: 0 0 0 3px rgba(161,92,0,.15); }

/* Les trois blocs : tuiles côte à côte, dépliées sur toute la largeur */
.jrep-grille { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; align-items: stretch; }
.jrep-grille[data-n="2"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.jrep-grille[data-n="1"] { grid-template-columns: minmax(0, 1fr); }
.jrep-bloc {
  --c: var(--j-accent);
  background: var(--j-bg); border: 1px solid var(--j-line); border-radius: 16px;
  min-width: 0; overflow: hidden; scroll-margin-top: 40px;
  transition: box-shadow .2s, border-color .2s;
}
.jrep-bloc-synthese { --c: #d9622b; }
.jrep-bloc-fresque { --c: #0f5c8c; }
.jrep-bloc-cartographie { --c: #2e9d6a; }
.jrep-bloc.is-plie:hover { border-color: var(--c); box-shadow: 0 6px 22px rgba(27,34,48,.08); }
.jrep-bloc:not(.is-plie) { grid-column: 1 / -1; }
.jrep-bloc.is-flash { box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 35%, transparent); }

.jrep-tuile { display: flex; flex-direction: column; align-items: flex-start; gap: 14px; padding: 22px 20px 18px; height: 100%; }
.jrep-bloc.is-plie:not(.is-plein) .jrep-tuile { min-height: 300px; }
.jrep-bloc:not(.is-plie) .jrep-tuile, .jrep-bloc.is-plein .jrep-tuile { height: auto; flex: none; }
.jrep-bloc.is-plein .jrep-bloc-corps { min-height: 0; }
.jrep-ico {
  appearance: none; border: 0; cursor: pointer; padding: 0;
  display: grid; place-items: center; flex: none;
  width: 92px; height: 92px; border-radius: 22px;
  background: var(--c); color: #fff;
  box-shadow: 0 8px 20px color-mix(in srgb, var(--c) 30%, transparent);
}
.jrep-ico svg { width: 54px; height: 54px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.jrep-ico svg circle { fill: currentColor; }
.jrep-tuile-txt { min-width: 0; flex: 1; }
.jrep-tuile-txt h3 { margin: 0; font-size: 19px; line-height: 1.25; color: var(--j-ink); font-weight: 700; }
.jrep-tuile-txt p { margin: 6px 0 0; color: var(--j-ink-2); font-size: 13.5px; }
.jrep-resume { margin-top: 12px; display: flex; flex-wrap: wrap; gap: 6px; }
.jrep-resume span {
  display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 12.5px; font-weight: 600;
  background: color-mix(in srgb, var(--c) 10%, #fff); color: color-mix(in srgb, var(--c) 75%, #000);
  font-variant-numeric: tabular-nums;
}
.jrep-bloc-act { display: flex; flex-wrap: wrap; gap: 8px; }
.jrep-btn {
  appearance: none; display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--j-line); background: #fff; color: var(--j-ink-2);
  border-radius: 10px; padding: 8px 13px; font: inherit; font-size: 13.5px; font-weight: 600; cursor: pointer; text-decoration: none;
}
.jrep-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: transform .2s; }
.jrep-btn:hover, .jrep-btn:focus-visible { border-color: var(--c); color: var(--c); }
.jrep-btn-main { background: var(--c); border-color: var(--c); color: #fff; }
.jrep-btn-main:hover, .jrep-btn-main:focus-visible { color: #fff; filter: brightness(1.08); }
.jrep-bloc:not(.is-plie) .jrep-btn-main svg { transform: rotate(180deg); }

/* Bloc déplié : en-tête horizontal compact */
.jrep-bloc:not(.is-plie) .jrep-tuile, .jrep-bloc.is-plein .jrep-tuile {
  flex-direction: row; align-items: center; gap: 16px; padding: 14px 18px;
  border-bottom: 1px solid var(--j-line); background: var(--j-bg-2); min-height: 0;
}
.jrep-bloc:not(.is-plie) .jrep-ico, .jrep-bloc.is-plein .jrep-ico { width: 64px; height: 64px; border-radius: 16px; }
.jrep-bloc:not(.is-plie) .jrep-ico svg, .jrep-bloc.is-plein .jrep-ico svg { width: 38px; height: 38px; }
.jrep-bloc:not(.is-plie) .jrep-resume, .jrep-bloc.is-plein .jrep-resume { margin-top: 6px; }
.jrep-bloc-corps { padding: 16px 18px; }
.jrep-bloc.is-plie:not(.is-plein) .jrep-bloc-corps { display: none; }
.jrep-bloc-fresque .jrep-bloc-corps { padding: 0 8px 4px; }
.jrep-bloc-fresque .fj-root { margin: 8px 0; border: 0; }
.jrep-bloc-cartographie .jrep-bloc-corps { padding: 0; }
.jrep-carto-frame { display: block; width: 100%; min-height: 520px; border: 0; background: #f2f4f1; }

/* Plein écran */
.jrep-bloc.is-plein {
  position: fixed; inset: 0; z-index: 100005; margin: 0; border-radius: 0; border: 0;
  display: flex; flex-direction: column; overflow: hidden; background: var(--j-bg);
}
.jrep-bloc.is-plein .jrep-bloc-corps { flex: 1; overflow: auto; display: block; }
.jrep-bloc-cartographie.is-plein .jrep-bloc-corps { overflow: hidden; }
.jrep-bloc.is-plein .jrep-carto-frame { height: 100% !important; min-height: 0; }
.jrep-bloc.is-plein [data-jrep-ouvrir].jrep-btn { display: none; }
.jrep-bloc.is-plein [data-jrep-plein] { background: var(--j-ink); border-color: var(--j-ink); color: #fff; }
html.jrep-sans-defilement, html.jrep-sans-defilement body { overflow: hidden !important; }

/* Synthèse */
.jrep-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; }
.jrep-kpi { border: 1px solid var(--j-line); border-radius: 10px; padding: 10px 12px; min-width: 0; }
.jrep-kpi b { display: block; font-size: 20px; line-height: 1.2; font-variant-numeric: tabular-nums; color: var(--j-ink); overflow-wrap: anywhere; }
.jrep-kpi span { display: block; color: var(--j-ink-3); font-size: 12px; margin-top: 2px; }
.jrep-kpi small { display: block; color: var(--j-ink-2); font-size: 11.5px; margin-top: 4px; }
.jrep-attente { color: var(--j-ink-3); margin: 0; }
.jrep-annees { margin-top: 16px; }
.jrep-annees h4 { margin: 0 0 8px; font-size: 13px; color: var(--j-ink-2); font-weight: 600; }
.jrep-an {
  display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; align-items: center; gap: 10px;
  padding: 5px 0; border: 0; background: none; width: 100%; font: inherit; color: inherit; text-align: left; cursor: pointer;
}
.jrep-an:hover .jrep-bar i, .jrep-an:focus-visible .jrep-bar i { filter: brightness(.92); }
.jrep-an.is-ex b { color: var(--j-accent); }
.jrep-an b { font-variant-numeric: tabular-nums; }
.jrep-bar { height: 14px; background: var(--j-bg-2); border-radius: 4px; overflow: hidden; display: flex; }
.jrep-bar i { display: block; height: 100%; background: var(--j-accent); }
.jrep-bar i + i { background: #8fb7d3; }
.jrep-an em { font-style: normal; color: var(--j-ink-2); font-size: 12.5px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.jrep-legende { display: flex; flex-wrap: wrap; gap: 14px; color: var(--j-ink-3); font-size: 12px; margin-top: 6px; }
.jrep-legende span::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 2px; background: var(--j-accent); margin-right: 5px; vertical-align: -1px; }
.jrep-legende span + span::before { background: #8fb7d3; }

@media (max-width: 960px) {
  .jrep-grille, .jrep-grille[data-n="2"] { grid-template-columns: minmax(0, 1fr); }
  .jrep-bloc.is-plie:not(.is-plein) .jrep-tuile { min-height: 0; flex-direction: row; flex-wrap: wrap; align-items: flex-start; }
  .jrep-bloc.is-plie:not(.is-plein) .jrep-bloc-act { margin-top: 0; }
  .jrep-bloc.is-plie .jrep-tuile-txt { flex: 1 1 220px; }
  .jrep-bloc.is-plie .jrep-bloc-act { width: 100%; }
}
@media (max-width: 720px) {
  .jrep-ico { width: 72px; height: 72px; border-radius: 18px; }
  .jrep-ico svg { width: 42px; height: 42px; }
  .jrep-bloc:not(.is-plie) .jrep-tuile, .jrep-bloc.is-plein .jrep-tuile { flex-wrap: wrap; }
  .jrep-bloc:not(.is-plie) .jrep-bloc-act, .jrep-bloc.is-plein .jrep-bloc-act { width: 100%; }
  .jrep-an { grid-template-columns: 44px minmax(0, 1fr); }
  .jrep-an em { grid-column: 2; }
  .jrep-carto-frame { height: 80vh !important; }
  .jrep-bloc.is-plein .jrep-carto-frame { height: 100% !important; }
}
.jrep-bloc.is-plie:not(.is-plein) .jrep-bloc-act { margin-top: auto; }

/* Image à l'arrière de la page : visible entre l'en-tête et les blocs */
.jrep-avec-fond .jrep-grille { margin-top: clamp(90px, 16vw, 260px); }
.jrep-suite.jrep-avec-fond { position: relative; isolation: isolate; padding: 22px; border-radius: 18px; background: #e9eeea; }
.jrep-suite.jrep-avec-fond.jrep-bleed { border-radius: 0; padding: 26px max(16px, 3vw) 32px; }
.jrep-suite.jrep-avec-fond::before {
  content: ""; position: absolute; z-index: -1; left: 0; right: 0; top: 0;
  height: min(100%, 780px); border-radius: inherit;
  background:
    linear-gradient(180deg, rgba(20, 32, 44, .06) 0%, rgba(233, 238, 234, 0) 60%, #e9eeea 100%),
    var(--jrep-fond) center 30% / cover no-repeat;
}
.jrep-avec-fond .jrep-head,
.jrep-avec-fond .jrep-bloc.is-plie:not(.is-plein) {
  background: rgba(255, 255, 255, .88);
  -webkit-backdrop-filter: blur(8px) saturate(1.1); backdrop-filter: blur(8px) saturate(1.1);
  border-color: rgba(255, 255, 255, .7);
  box-shadow: 0 8px 28px rgba(20, 32, 44, .14);
}
.jrep-avec-fond .jrep-bloc.is-plie:not(.is-plein):hover { border-color: var(--c); box-shadow: 0 12px 34px rgba(20, 32, 44, .2); }
.jrep-avec-fond .jrep-bloc:not(.is-plie) { box-shadow: 0 8px 28px rgba(20, 32, 44, .12); }
@media (max-width: 720px) {
  .jrep-suite.jrep-avec-fond, .jrep-suite.jrep-avec-fond.jrep-bleed { padding: 16px 12px 22px; }
  .jrep-avec-fond .jrep-grille { margin-top: 150px; }
  .jrep-suite.jrep-avec-fond::before { height: min(100%, 560px); background-position: 60% 30%, 60% 30%; }
}

/* Accès par code */
.jrep-qui { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12.5px; color: var(--j-ink-2); }
.jrep-qui .jrep-btn { padding: 4px 10px; font-size: 12.5px; }
.jrep-porte { min-height: 70vh; display: grid; place-items: center; padding: 40px 16px; }
.jrep-porte.jrep-avec-fond::before { height: 100%; }
.jrep-porte-carte {
  width: min(440px, 100%); background: rgba(255,255,255,.93); border: 1px solid rgba(255,255,255,.7); border-radius: 18px;
  padding: 26px 26px 20px; box-shadow: 0 16px 44px rgba(20,32,44,.22); text-align: center;
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
.jrep-porte-carte .jrep-logo { height: 70px; margin: 0 auto 10px; }
.jrep-porte-carte h2 { margin: 0 0 6px; font-size: 21px; font-weight: 700; color: var(--j-ink); }
.jrep-porte-carte p { margin: 0 0 14px; color: var(--j-ink-2); }
.jrep-porte-form { text-align: left; }
.jrep-porte-form > label:first-child { display: block; font-weight: 600; font-size: 13px; margin-bottom: 6px; color: var(--j-ink); }
.jrep-porte-ligne { display: flex; gap: 8px; }
.jrep-porte-ligne input {
  flex: 1; min-width: 0; font: inherit; font-size: 17px; letter-spacing: .08em; padding: 10px 12px;
  border: 1px solid #cfd5df; border-radius: 10px; background: #fff; color: var(--j-ink);
}
.jrep-porte-ligne input:focus { outline: 2px solid var(--j-accent); outline-offset: 1px; border-color: var(--j-accent); }
.jrep-porte .jrep-btn-main { --c: var(--j-accent); padding: 10px 18px; font-size: 15px; }
.jrep-porte-voir { display: inline-flex; gap: 6px; align-items: center; margin-top: 8px; font-size: 12.5px; color: var(--j-ink-3); }
.jrep-porte-err { background: #fdecea; color: #b42318 !important; border-radius: 8px; padding: 8px 10px; font-size: 13px; }
.jrep-porte-compte { margin: 16px 0 0 !important; font-size: 12.5px; color: var(--j-ink-3) !important; }
.jrep-porte-form > label { display: block; font-weight: 600; font-size: 13px; margin: 10px 0 6px; color: var(--j-ink); }
.jrep-porte-form > label.jrep-porte-voir { display: inline-flex; font-weight: 400; margin-top: 8px; }
.jrep-porte-champ {
  display: block; width: 100%; font: inherit; font-size: 16px; padding: 10px 12px;
  border: 1px solid #cfd5df; border-radius: 10px; background: #fff; color: var(--j-ink);
}
.jrep-porte-champ:focus { outline: 2px solid var(--j-accent); outline-offset: 1px; border-color: var(--j-accent); }
