/* Jeunes Prodiges · version PHP — design « ardoise & sarcelle »
   Aucun style en ligne : tout est ici (la politique de sécurité du navigateur l'interdit). */

:root {
  --bg: #f3f6f7; --surface: #ffffff; --surface-2: #f7fafb; --ink: #12262d; --mute: #5a717a; --line: #dbe5e8;
  --brand: #0e7c86; --brand-ink: #ffffff; --brand-soft: #dff1f3; --accent: #f2a900; --accent-soft: #fff3d1;
  --side: #0f2a33; --side-ink: #d5e6ea; --side-mute: #7fa0a9; --side-hover: #173a45;
  --ok: #1f8a4c; --ok-bg: #e0f3e8; --wait: #a86b00; --wait-bg: #fdefcf; --bad: #c0392b; --bad-bg: #fbe3df; --info: #2b6cb0; --info-bg: #e1edfa;
  --sec0: #5c7a9e; --sec1: #172140; --sec2: #b5523b; --gold: #c9a34f;
  --radius: 14px; --shadow: 0 1px 2px rgba(15, 42, 51, .06), 0 6px 20px rgba(15, 42, 51, .05);
  --focus: 0 0 0 3px rgba(14, 124, 134, .35);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b171c; --surface: #11242b; --surface-2: #162d35; --ink: #e5f0f2; --mute: #93aab2; --line: #243f49;
    --brand: #35b8c4; --brand-ink: #062a2f; --brand-soft: #123a41; --accent: #f5b82e; --accent-soft: #3b2f0e;
    --side: #08141a; --side-ink: #d5e6ea; --side-mute: #7fa0a9; --side-hover: #173a45;
    --ok: #5fd08a; --ok-bg: #12351f; --wait: #f0b94d; --wait-bg: #3a2c0b; --bad: #ff8b7d; --bad-bg: #44201b; --info: #7db6f0; --info-bg: #173047;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0b171c; --surface: #11242b; --surface-2: #162d35; --ink: #e5f0f2; --mute: #93aab2; --line: #243f49;
  --brand: #35b8c4; --brand-ink: #062a2f; --brand-soft: #123a41; --accent: #f5b82e; --accent-soft: #3b2f0e; --side: #08141a;
  --ok: #5fd08a; --ok-bg: #12351f; --wait: #f0b94d; --wait-bg: #3a2c0b; --bad: #ff8b7d; --bad-bg: #44201b; --info: #7db6f0; --info-bg: #173047;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4); color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; }
h1, h2, h3, h4 { line-height: 1.25; margin: 0; }
a { color: var(--brand); }
img { max-width: 100%; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 8px; }
[hidden] { display: none !important; }
.ic { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--brand); color: var(--brand-ink); padding: 8px 14px; border-radius: 8px; z-index: 100; }
.skip:focus { left: 8px; }
.mute { color: var(--mute); }
.small { font-size: 13px; }
.inline { display: inline; margin: 0; }

/* ---------- Structure : menu latéral + contenu ---------- */
body.app { display: grid; grid-template-columns: 264px 1fr; min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; background: var(--side); color: var(--side-ink); display: flex; flex-direction: column; padding: 18px 14px; overflow-y: auto; }
.brand { padding: 4px 8px 16px; }
.brand img { width: 150px; height: auto; display: block; filter: brightness(0) invert(1); opacity: .95; }
.side nav { flex: 1; }
.side .grp { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--side-mute); margin: 18px 10px 6px; font-weight: 600; }
.side nav a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; color: var(--side-ink); text-decoration: none; font-weight: 500; margin-bottom: 2px; }
.side nav a:hover { background: var(--side-hover); }
.side nav a[aria-current="page"] { background: var(--brand); color: var(--brand-ink); }
.badge { margin-left: auto; background: var(--accent); color: #2a1d00; font-style: normal; font-size: 11px; font-weight: 700; border-radius: 999px; padding: 1px 7px; }
.me { display: flex; align-items: center; gap: 8px; border-top: 1px solid rgba(255, 255, 255, .1); padding-top: 14px; margin-top: 10px; }
.me-link { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; color: var(--side-ink); text-decoration: none; }
.me-link span { display: grid; min-width: 0; }
.me-link b { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-link small { color: var(--side-mute); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side .icon-btn { color: var(--side-ink); }
.side .icon-btn:hover { background: var(--side-hover); }

.shell { min-width: 0; display: flex; flex-direction: column; }
.top { display: flex; align-items: center; gap: 12px; padding: 18px 28px 6px; }
.ttl { flex: 1; min-width: 0; }
.ttl h1 { font-size: 24px; letter-spacing: -.01em; }
.ttl p { margin: 2px 0 0; color: var(--mute); font-size: 14px; }
.tools { display: flex; gap: 6px; }
.icon-btn.menu-btn { display: none; }
body.app main { padding: 14px 28px 40px; max-width: 1180px; width: 100%; }
main:focus { outline: none; }
.foot { margin-top: auto; padding: 18px 28px; color: var(--mute); font-size: 12.5px; border-top: 1px solid var(--line); }
.scrim { position: fixed; inset: 0; background: rgba(5, 18, 22, .55); z-index: 40; }

.icon-btn { position: relative; display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; border: 0; background: transparent; color: var(--ink); cursor: pointer; text-decoration: none; }
.icon-btn:hover { background: var(--brand-soft); }
.dot-badge { position: absolute; top: 3px; right: 2px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; background: var(--bad); color: #fff; font-size: 10.5px; font-weight: 700; font-style: normal; display: grid; place-items: center; }

/* ---------- Boutons, formulaires ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 16px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; line-height: 1.2; }
.btn:hover { border-color: var(--brand); color: var(--brand); }
.btn.p { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn.p:hover { filter: brightness(1.08); color: var(--brand-ink); }
.btn.danger { color: var(--bad); }
.btn.danger:hover { border-color: var(--bad); color: var(--bad); }
.btn.sm { padding: 5px 11px; font-size: 13px; }
.btn.wide { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.acts { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; margin-top: 16px; }
.acts.start { justify-content: flex-start; }
.stack { max-width: 640px; }
.fld { margin-bottom: 16px; display: grid; gap: 5px; }
.fld label { font-weight: 600; font-size: 14px; }
.hint { color: var(--mute); font-size: 12.5px; }
input[type=text], input[type=email], input[type=tel], input[type=password], input[type=number], input[type=date], input[type=time], input[type=search], select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); font: inherit; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: var(--focus); }
input[type=file] { font: inherit; max-width: 100%; }
.check { display: flex; gap: 8px; align-items: center; font-weight: 500; margin-top: 6px; }
.photo-pick { display: flex; gap: 16px; align-items: center; }
.back { display: inline-block; margin-bottom: 8px; color: var(--mute); text-decoration: none; font-size: 14px; }
.back:hover { color: var(--brand); }

.flash { padding: 12px 16px; border-radius: 12px; margin-bottom: 14px; font-weight: 500; border: 1px solid transparent; transition: opacity .4s; }
.flash.ok { background: var(--ok-bg); color: var(--ok); border-color: var(--ok); }
.flash.bad { background: var(--bad-bg); color: var(--bad); border-color: var(--bad); }
.flash.gone { opacity: 0; height: 0; padding: 0; margin: 0; overflow: hidden; border: 0; }

/* ---------- Cartes, listes, tableaux ---------- */
.panel, .card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; margin-bottom: 16px; }
.card.flush { padding: 0; overflow: hidden; }
.card h3, .panel h2 { font-size: 16px; margin-bottom: 12px; }
.panel > h2 { font-size: 20px; margin-bottom: 14px; }
.card .h { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
.grid > .card { margin-bottom: 0; }
h3.grp { font-size: 12.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--mute); margin: 22px 2px 10px; }
.note { color: var(--mute); font-size: 13.5px; margin: 8px 0; }
.empty { padding: 26px 16px; text-align: center; color: var(--mute); }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi { display: grid; gap: 2px; background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--brand); border-radius: var(--radius); padding: 14px 16px; text-decoration: none; color: var(--ink); box-shadow: var(--shadow); }
a.kpi:hover { border-left-color: var(--accent); }
.kpi b { font-size: 28px; line-height: 1.1; letter-spacing: -.02em; }
.kpi span { color: var(--mute); font-size: 13px; }

.av { display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); font-weight: 700; font-size: 13px; overflow: hidden; flex: none; }
.av img { width: 100%; height: 100%; object-fit: cover; display: block; }
.av.big { width: 76px; height: 76px; font-size: 24px; }
.side .av { background: var(--brand); color: var(--brand-ink); }

.pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.pill.ok { background: var(--ok-bg); color: var(--ok); } .pill.wait { background: var(--wait-bg); color: var(--wait); }
.pill.bad { background: var(--bad-bg); color: var(--bad); } .pill.info { background: var(--info-bg); color: var(--info); }

.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--mute); padding: 10px 16px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.tbl td { padding: 11px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover { background: var(--surface-2); }
.tbl .who { display: flex; align-items: center; gap: 12px; color: var(--ink); text-decoration: none; font-weight: 600; }
.tbl .who small { display: block; color: var(--mute); font-weight: 400; font-size: 12.5px; }
.tbl .r { text-align: right; }
.scroll-x { overflow-x: auto; }

.row { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); color: var(--ink); text-decoration: none; }
.row:last-child { border-bottom: 0; }
a.row:hover { background: var(--surface-2); }
.row .t { flex: 1; min-width: 0; display: grid; }
.row .t b { font-weight: 600; } .row .t span { color: var(--mute); font-size: 13px; }
.row .t .sb { font-size: 12.5px; }

.kv { display: flex; justify-content: space-between; gap: 16px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.kv:last-child { border-bottom: 0; } .kv span { color: var(--mute); }
.kv b { font-weight: 600; text-align: right; }

progress.meter { appearance: none; -webkit-appearance: none; width: 100%; height: 8px; border: 0; border-radius: 99px; background: var(--brand-soft); overflow: hidden; display: block; }
progress.meter::-webkit-progress-bar { background: var(--brand-soft); border-radius: 99px; }
progress.meter::-webkit-progress-value { background: var(--brand); border-radius: 99px; }
progress.meter::-moz-progress-bar { background: var(--brand); border-radius: 99px; }
.bl { display: grid; grid-template-columns: minmax(90px, 40%) 1fr 36px; gap: 10px; align-items: center; padding: 5px 0; font-size: 14px; }
.bl b { text-align: right; }
.big-num { font-size: 30px; font-weight: 800; letter-spacing: -.02em; }

.task { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.task:last-child { border-bottom: 0; }
.task .dot { width: 9px; height: 9px; border-radius: 50%; flex: none; background: var(--info); }
.task .dot.bad { background: var(--bad); } .task .dot.wait { background: var(--wait); } .task .dot.gold { background: var(--accent); }
.task span { margin-left: auto; color: var(--mute); font-size: 13px; white-space: nowrap; }

.seg { display: inline-flex; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 4px; margin-bottom: 16px; gap: 2px; flex-wrap: wrap; }
.seg a { padding: 7px 16px; border-radius: 9px; text-decoration: none; color: var(--mute); font-weight: 600; }
.seg a[aria-current="page"] { background: var(--brand); color: var(--brand-ink); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 14px; }
.chip { padding: 5px 13px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); text-decoration: none; color: var(--ink); font-size: 13.5px; }
.chip[aria-current="true"] { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.search { display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 0 12px; margin-bottom: 14px; max-width: 480px; }
.search input { border: 0; background: transparent; box-shadow: none !important; padding: 10px 0; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px; }
.toolbar .grow { flex: 1; }

/* ---------- Page « fiche » ---------- */
.who-head { display: flex; align-items: center; gap: 18px; margin-bottom: 14px; }
.who-head h2 { font-size: 22px; margin-bottom: 4px; }

/* ---------- Prochain événement ---------- */
.next { background: linear-gradient(120deg, var(--brand), #0a5d65); color: #fff; border-radius: var(--radius); padding: 18px 22px; margin-bottom: 18px; box-shadow: var(--shadow); }
.next .l { margin: 0; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; opacity: .85; }
.next h3 { font-size: 22px; margin: 4px 0; }
.next p { margin: 0; opacity: .92; }
.next .f { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 14px; flex-wrap: wrap; }
.next .btn { background: rgba(255, 255, 255, .14); border-color: rgba(255, 255, 255, .5); color: #fff; }
.next .btn:hover { background: #fff; color: #0a5d65; }

/* ---------- Programme d'un culte ---------- */
.prog { border: 1.5px solid var(--sec1); border-radius: var(--radius); overflow: hidden; background: var(--surface); margin-bottom: 14px; }
.prog .church { text-align: center; font-weight: 800; font-size: 18px; padding: 12px 6px; letter-spacing: .02em; }
.prog .when { background: var(--sec1); color: #fff; text-align: center; font-style: italic; font-size: 13px; padding: 7px; }
.prog .cols, .prog .step { display: grid; grid-template-columns: 70px 80px 1fr 1fr 48px; gap: 8px; align-items: center; padding: 8px 14px; text-align: center; font-size: 14px; }
.prog .cols { font-weight: 700; font-size: 11px; letter-spacing: .04em; }
.prog .step:nth-child(even) { background: rgba(128, 128, 128, .08); }
.prog .step .acts-cell { display: flex; gap: 4px; justify-content: flex-end; }
.prog .sec { color: #fff; text-align: center; font-weight: 700; font-size: 12px; padding: 6px 0; letter-spacing: .06em; }
.prog .sec.s0 { background: var(--sec0); } .prog .sec.s1 { background: var(--sec1); } .prog .sec.s2 { background: var(--sec2); }
.prog .end { background: var(--gold); color: #fff; text-align: center; font-weight: 700; font-size: 12px; padding: 6px 0; }
.prog .foot-bar { background: var(--sec1); color: #fff; text-align: center; font-weight: 700; padding: 10px 6px; line-height: 1.5; }
.x-btn { border: 0; background: none; color: var(--bad); font-size: 18px; cursor: pointer; padding: 0 6px; }
.x-btn:hover { background: var(--bad-bg); border-radius: 6px; }

/* ---------- Fréquentation ---------- */
.count-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.count-row b { font-size: 15px; }
.count-row input[type=number] { width: 110px; text-align: center; font-size: 17px; }
.count-total { display: flex; justify-content: space-between; align-items: center; border-top: 2px solid var(--line); padding-top: 12px; }
.count-total b:last-child { font-size: 28px; }
.dec { border: 1px dashed var(--line); border-radius: 12px; padding: 12px 14px; margin-top: 12px; }

/* ---------- Graphique ---------- */
.chart { width: 100%; height: auto; }
.chart .col { fill: var(--info-bg); } .chart .col.last { fill: var(--accent); }
.chart text { fill: var(--mute); font-size: 9px; } .chart text.v { fill: var(--ink); }

/* ---------- Connexion et pages simples ---------- */
body.plain { display: block; }
.login { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login-hero { background: linear-gradient(150deg, #0f2a33, #0e7c86); color: #fff; padding: 60px; display: flex; flex-direction: column; justify-content: center; gap: 18px; }
.login-hero .logo { width: 170px; filter: brightness(0) invert(1); }
.login-hero h2 { font-size: 34px; letter-spacing: -.02em; max-width: 14em; }
.login-hero p { font-size: 17px; opacity: .88; max-width: 28em; margin: 0; }
.login-card { padding: 60px; max-width: 520px; margin: auto; width: 100%; }
.login-card h1 { font-size: 28px; margin-bottom: 6px; }
.login-card form { margin: 22px 0 14px; }
.center-card { max-width: 480px; margin: 12vh auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 36px; text-align: center; box-shadow: var(--shadow); }
.center-card .logo { width: 130px; margin-bottom: 14px; }

/* ---------- Téléphone et tablette ---------- */
@media (max-width: 960px) {
  body.app { display: block; }
  .side { position: fixed; z-index: 50; inset: 0 auto 0 0; width: 280px; transform: translateX(-102%); transition: transform .2s; }
  .side.open { transform: none; box-shadow: 0 0 40px rgba(0, 0, 0, .35); }
  .icon-btn.menu-btn { display: inline-grid; }
  .top { padding: 14px 16px 4px; }
  body.app main { padding: 10px 16px 32px; }
  .foot { padding: 16px; }
  .grid { grid-template-columns: 1fr; }
  .login { grid-template-columns: 1fr; }
  .login-hero { padding: 36px 24px; } .login-hero h2 { font-size: 26px; }
  .login-card { padding: 28px 20px; }
  .prog .cols, .prog .step { grid-template-columns: 52px 56px 1fr 40px; font-size: 13px; }
  .prog .cols span:nth-child(4), .prog .step span:nth-child(4) { display: none; }
  .tbl th, .tbl td { padding: 10px 12px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
@media print { .side, .top .tools, .menu-btn, .foot, .acts { display: none !important; } body.app { display: block; } }

/* Bouton « Présent / Absent » des listes de présence */
.pill-btn { border: 0; cursor: pointer; padding: 5px 16px; border-radius: 999px; font: inherit; font-size: 13px; font-weight: 700; min-width: 92px; }
.pill-btn.ok { background: var(--ok-bg); color: var(--ok); } .pill-btn.bad { background: var(--bad-bg); color: var(--bad); }
.pill-btn:hover { filter: brightness(.95); }
.msg-body { white-space: normal; }

/* Assistant d'installation */
.install { max-width: 640px; margin: 5vh auto; padding: 32px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.install .logo { width: 130px; margin-bottom: 8px; } .install h1 { font-size: 26px; margin-bottom: 6px; } .install h2 { font-size: 17px; margin: 22px 0 10px; }
.checks { list-style: none; padding: 0; margin: 0 0 10px; } .checks li { padding: 5px 0; } .checks .ok { color: var(--ok); } .checks .bad { color: var(--bad); font-weight: 600; }
code { background: var(--brand-soft); padding: 1px 6px; border-radius: 6px; font-size: .92em; }

/* Utilitaires (remplacent les styles en ligne, interdits par la politique de sécurité) */
.m0 { margin: 0 !important; } .ta-c { text-align: center; } .jc-c { justify-content: center; } .mt12 { margin-top: 12px; }
.w720 { max-width: 720px; } .w560 { max-width: 560px; } .c-bad { color: var(--bad) !important; }
.plain-link { text-decoration: none; color: inherit; } .between { display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.acct-name { margin: 10px 0 2px !important; }

/* Circuit de validation */
.flow { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 6px 0; }
.flow + .flow { border-top: 1px solid var(--line); }
.flow-l { font-weight: 600; min-width: 86px; }
.flow-note { color: var(--mute); font-size: 13px; flex-basis: 100%; }
.flow-card { margin-bottom: 8px; }
a.task { color: inherit; text-decoration: none; }
a.task:hover { background: var(--hover, rgba(0,0,0,.03)); }

#pwa-box { margin: 14px 0; }
#pwa-box .btn[hidden], #pwa-box p[hidden] { display: none; }
