/* ABPE — couleurs du logo : orange #E8664A, bleu #27B8EA, vert #B8D166 (versions foncées pour le texte) */
:root {
  --ink: #1F2A33; --ink2: #3A4650; --muted: #5B6770; --line: #E4EAEE; --line2: #EEF2F5; --bg: #F5F8FA;
  --blue: #0A6F99; --blue-l: #E3F5FC; --blue-b: #27B8EA;
  --green: #4E7A12; --green-t: #3F5709; --green-l: #EEF5D8; --green-b: #B8D166;
  --red: #B9442A; --red-t: #A63C24; --red-l: #FCE9E4; --red-b: #E8664A; --logo-red: #C9502F;
  --warn: #7A4B00; --warn-l: #FFF4E0;
  --font: Nunito, "Segoe UI", system-ui, -apple-system, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--font); color: var(--ink); background: var(--bg); -webkit-text-size-adjust: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--blue); }
h1 { margin: 0; font-size: 24px; font-weight: 800; }
h2 { margin: 0; font-size: 16px; font-weight: 800; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.hidden { display: none !important; }

/* ---------- Boutons et champs ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 16px; border-radius: 10px;
  border: 1.5px solid var(--blue); background: #fff; color: var(--blue); font-size: 14px; font-weight: 700; cursor: pointer; text-decoration: none; }
.btn.primary { background: var(--blue); color: #fff; }
.btn.ok { background: var(--green); border-color: var(--green); color: #fff; }
.btn.ghost { border-color: #C9D3DA; color: var(--ink2); }
.btn.danger { border-color: var(--red-l); background: var(--red-l); color: var(--red-t); }
.btn.block { width: 100%; }
.btn:disabled { opacity: .55; cursor: default; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 700; }
.input, select.input, textarea.input { width: 100%; min-height: 42px; padding: 8px 12px; border: 1.5px solid #C9D3DA; border-radius: 10px; font-size: 15px; background: #fff; font-weight: 400; }
textarea.input { resize: vertical; }
.check { display: flex; align-items: center; gap: 10px; font-size: 15px; cursor: pointer; }
.check input { width: 22px; height: 22px; accent-color: var(--blue); flex-shrink: 0; }
.chip { display: inline-block; align-self: flex-start; padding: 3px 8px; border-radius: 6px; font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; }
.chip.evenement, .chip.event { background: var(--blue-l); color: var(--blue); }
.chip.seance { background: var(--red-l); color: var(--red-t); }
.chip.prep { background: var(--green-l); color: var(--green-t); }
.card { background: #fff; border: 1px solid var(--line); border-radius: 14px; }
.notice { padding: 10px 12px; border-radius: 10px; font-size: 14px; background: var(--warn-l); color: var(--warn); }
.notice.ok { background: var(--green-l); color: var(--green-t); }
.notice.info { background: var(--blue-l); color: #08587A; }
#toast { position: fixed; left: 50%; bottom: 90px; transform: translate(-50%, 20px); max-width: min(92vw, 460px); padding: 12px 16px; border-radius: 12px;
  background: var(--ink); color: #fff; font-size: 14px; opacity: 0; pointer-events: none; transition: .2s; z-index: 50; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Appli membre ---------- */
.app { max-width: 560px; margin: 0 auto; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; background: var(--bg); }
.top { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 10px; padding: 10px 14px; padding-top: max(10px, env(safe-area-inset-top));
  background: #fff; border-bottom: 1px solid var(--line); }
.top img { width: 42px; height: 42px; }
.brand { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.brand b { color: var(--logo-red); font-size: 20px; line-height: 1; letter-spacing: .02em; }
.brand span { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.iconbtn { width: 44px; height: 44px; border: 0; border-radius: 50%; background: #F0F3F5; color: var(--blue); display: flex; align-items: center; justify-content: center; cursor: pointer; flex-shrink: 0; }
.net { display: flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px; border-radius: 999px; font-size: 12px; font-weight: 700; border: 1px solid #CFE3A6; background: #F3F8E6; color: var(--green-t); white-space: nowrap; }
.net i { width: 8px; height: 8px; border-radius: 50%; background: #6E9A1E; }
.net.off { border-color: #E7C98F; background: var(--warn-l); color: var(--warn); }
.net.off i { background: #D98A00; }
.banner { padding: 8px 14px; font-size: 13px; background: var(--warn-l); color: var(--warn); border-bottom: 1px solid #F3DEB4; }
main.view { flex: 1; padding: 16px; display: flex; flex-direction: column; gap: 12px; padding-bottom: 96px; }
.nav { position: fixed; bottom: 0; left: 0; right: 0; z-index: 10; display: flex; justify-content: center; background: #fff; border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.nav-in { width: 100%; max-width: 560px; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; padding: 6px 8px; }
.nav button, .nav a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 50px; border: 0; background: none;
  font-size: 12px; font-weight: 700; color: var(--muted); cursor: pointer; text-decoration: none; }
.nav .on { color: var(--blue); }

.login { display: flex; flex-direction: column; align-items: center; gap: 16px; padding: 40px 28px; max-width: 420px; margin: 0 auto; width: 100%; }
.login img { width: 170px; height: 170px; }
.pin { height: 56px; text-align: center; font-size: 26px; letter-spacing: 10px; }

.filters { display: flex; gap: 6px; flex-wrap: wrap; }
.pill { min-height: 38px; padding: 0 14px; border-radius: 999px; border: 1.5px solid #C9D3DA; background: #fff; color: var(--ink2); font-size: 13px; font-weight: 700; cursor: pointer; }
.pill.on { background: var(--blue); border-color: var(--blue); color: #fff; }
.month { margin: 8px 0 0; font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.act { display: flex; gap: 12px; padding: 12px; width: 100%; text-align: left; cursor: pointer; background: #fff; border: 1px solid var(--line); border-radius: 14px; }
.act.past { opacity: .6; }
.date { width: 56px; flex-shrink: 0; border-radius: 10px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 6px 0; }
.date b { font-size: 22px; line-height: 1; }
.date span { font-size: 12px; font-weight: 700; }
.date.evenement { background: var(--blue-l); border-top: 4px solid var(--blue-b); }
.date.seance { background: var(--red-l); border-top: 4px solid var(--red-b); }
.act-body { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1; }
.act-title { font-size: 16px; font-weight: 800; }
.st { font-size: 13px; font-weight: 700; color: var(--muted); }
.st.done { color: var(--green-t); } .st.part { color: var(--warn); }

.slot { display: flex; flex-direction: column; gap: 10px; padding: 14px; background: #fff; border: 1px solid var(--line); border-radius: 14px; border-top: 4px solid var(--blue-b); }
.slot.prep { border-top-color: var(--green-b); } .slot.seance { border-top-color: var(--red-b); }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ans { min-height: 48px; border-radius: 12px; font-size: 15px; font-weight: 800; cursor: pointer; background: #fff; }
.ans.yes { border: 2px solid var(--green); color: var(--green); } .ans.yes.on { background: var(--green); color: #fff; }
.ans.no { border: 2px solid var(--red); color: var(--red); } .ans.no.on { background: var(--red); color: #fff; }
.rows { display: flex; flex-direction: column; border: 1px solid var(--line2); border-radius: 12px; background: #fff; }
.row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--line2); }
.row:last-child { border-bottom: 0; }
.row-main { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.cnt-ok { color: var(--green-t); font-weight: 700; } .cnt-miss { color: var(--red-t); font-weight: 700; }
.take { flex-shrink: 0; min-height: 44px; max-width: 128px; padding: 6px 12px; border-radius: 10px; font-size: 13px; font-weight: 800; cursor: pointer; border: 1.5px solid var(--green); background: #fff; color: var(--green); }
.take.on { background: var(--green); color: #fff; }
.take:disabled { border-color: var(--line); background: var(--bg); color: var(--muted); cursor: default; }
.back { align-self: flex-start; display: inline-flex; align-items: center; gap: 4px; min-height: 44px; padding: 0 8px 0 0; border: 0; background: none; color: var(--blue); font-size: 15px; font-weight: 700; cursor: pointer; }
.contact { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; }
.contact .role { font-size: 12px; font-weight: 800; color: var(--red-t); text-transform: uppercase; letter-spacing: .04em; }

/* ---------- Espace admin ---------- */
.admin { display: flex; flex-wrap: wrap; min-height: 100vh; }
.side { flex: 1 1 220px; max-width: 100%; background: #fff; border-right: 1px solid var(--line); padding: 20px 14px; display: flex; flex-direction: column; gap: 4px; }
.side .logo { display: flex; align-items: center; gap: 10px; padding: 0 6px 16px; }
.side .logo img { width: 48px; height: 48px; }
.tab { text-align: left; min-height: 44px; padding: 0 12px; border: 0; border-radius: 10px; font-size: 15px; font-weight: 700; cursor: pointer; background: none; color: var(--ink2); }
.tab.on { background: var(--blue-l); color: var(--blue); }
.content { flex: 999 1 560px; min-width: 0; padding: 28px 32px 60px; display: flex; flex-direction: column; gap: 18px; }
.head { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.head > div { flex: 1; min-width: 200px; }
.panel { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.panel.blue { border-top: 4px solid var(--blue-b); } .panel.green { border-top: 4px solid var(--green-b); }
.grid3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.tablebox { background: #fff; border: 1px solid var(--line); border-radius: 14px; overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
table.t th { text-align: left; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .05em; padding: 12px 10px; }
table.t td { padding: 10px; border-top: 1px solid var(--line2); vertical-align: middle; }
table.t td:first-child, table.t th:first-child { padding-left: 16px; }
.nowrap { white-space: nowrap; }
.slotedit { display: flex; flex-direction: column; gap: 10px; padding: 14px; background: #FAFCFD; border: 1px solid var(--line); border-left: 4px solid var(--blue-b); border-radius: 12px; }
.slotedit.prep { border-left-color: var(--green-b); } .slotedit.seance { border-left-color: var(--red-b); }
.line { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.line .grow { flex: 1 1 200px; }
.mini { display: flex; gap: 8px; align-items: center; }
.mini .input { min-height: 38px; }
.x { width: 40px; height: 40px; flex-shrink: 0; border: 0; border-radius: 10px; background: var(--red-l); color: var(--red-t); font-size: 18px; font-weight: 800; cursor: pointer; }
.cols3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; font-size: 14px; }
.pinbox { font-size: 34px; font-weight: 800; letter-spacing: 6px; color: var(--blue); }
.modal { position: fixed; inset: 0; background: rgba(20, 30, 40, .45); display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 40; }
.modal .panel { max-width: 440px; width: 100%; }
@media (max-width: 700px) { .content { padding: 18px 14px 60px; } .side { border-right: 0; border-bottom: 1px solid var(--line); flex-direction: row; flex-wrap: wrap; } .side .logo { width: 100%; } .side .spacer { display: none; } }

/* ---------- Programme imprimable ---------- */
.prog { max-width: 800px; margin: 0 auto; padding: 24px; background: #fff; min-height: 100vh; }
.prog header { display: flex; align-items: center; gap: 16px; border-bottom: 3px solid var(--blue-b); padding-bottom: 12px; margin-bottom: 8px; }
.prog header img { width: 80px; height: 80px; }
.prog h2 { margin: 18px 0 6px; color: var(--logo-red); font-size: 18px; }
.prog .item { display: flex; gap: 14px; padding: 8px 0; border-bottom: 1px solid var(--line2); break-inside: avoid; font-size: 14px; }
.prog .item .d { width: 130px; flex-shrink: 0; font-weight: 800; }
@media print { .noprint { display: none !important; } .prog { padding: 0; } body { background: #fff; } }

/* ---------- Visionneuse de document (tournées…) ---------- */
#docview { position: fixed; inset: 0; z-index: 60; background: #fff; display: flex; flex-direction: column; }
#docview .docbar { display: flex; align-items: center; gap: 10px; padding: 8px 10px; padding-top: max(8px, env(safe-area-inset-top)); background: var(--blue); color: #fff; }
#docview .docbar span { font-weight: 700; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#docview .docback { flex-shrink: 0; min-height: 44px; padding: 0 14px; border: 0; border-radius: 10px; background: #fff; color: var(--blue); font-size: 15px; font-weight: 800; cursor: pointer; }
#docview iframe { flex: 1; width: 100%; border: 0; }
.remark { display: flex; flex-direction: column; gap: 6px; }

/* ---------- Lien discret, page Informations ---------- */
.linkbtn { border: 0; background: none; padding: 6px 0; color: var(--blue); text-decoration: underline; font-size: 13px; font-weight: 700; cursor: pointer; }
.infotext h2 { font-size: 16px; margin: 18px 0 6px; } .infotext h2:first-child { margin-top: 0; }
.infotext p { margin: 0 0 8px; line-height: 1.5; font-size: 15px; } .infotext ul { margin: 0 0 8px; padding-left: 20px; line-height: 1.5; font-size: 15px; }
