/* =====================================================================
   CRÉNO — styles (blanc, blanc cassé, bleu électrique)
   ===================================================================== */
:root {
  --white: #FFFFFF;
  --paper: #F5F3EE;
  --paper-2: #ECE9E2;
  --line: #E2DFD8;
  --ink: #0D0F1F;
  --ink-2: #2A2D40;
  --muted: #4A4D60;
  --blue: #2F3BFF;
  --blue-dk: #1A24C9;
  --blue-mist: #E8EAFF;
  --ok: #0F7B52;
  --ok-bg: #E2F5EC;
  --warn: #8A5A00;
  --warn-bg: #FFF1D6;
  --bad: #B3261E;
  --bad-bg: #FDE7E6;
  --r: 18px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --display: "Bricolage Grotesque", Inter, system-ui, sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--paper); color: var(--ink); font: 16px/1.5 Inter, system-ui, -apple-system, sans-serif; }
body { min-height: 100dvh; }
h1, h2, h3 { font-family: var(--display); margin: 0; letter-spacing: -.025em; line-height: 1.08; }
h1 { font-size: clamp(1.8rem, 5vw, 2.4rem); font-weight: 800; }
h2 { font-size: 1.35rem; font-weight: 700; }
h3 { font-size: 1.08rem; font-weight: 700; letter-spacing: -.01em; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--blue); }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: .88rem; }
.center { text-align: center; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; border-radius: 8px; }

/* ---------- logo ---------- */
.splash { min-height: 100dvh; display: grid; place-items: center; }
.logo-word { font: 800 2.6rem/1 var(--display); letter-spacing: -.05em; color: var(--ink); }
.logo-word b { color: var(--blue); font-weight: 800; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.brand svg { flex: none; }
.brand .logo-word { font-size: 1.55rem; }
@keyframes slotIn { 0%, 15% { transform: translateX(14px); opacity: 0 } 35%, 100% { transform: none; opacity: 1 } }
.slot-anim { animation: slotIn 2.6s cubic-bezier(.2,.8,.2,1) infinite; transform-box: fill-box; }

/* ---------- mise en page ---------- */
.topbar { position: sticky; top: 0; z-index: 20; background: rgba(245,243,238,.9); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); padding-top: var(--safe-t); }
.topbar-in { max-width: 1040px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.topbar .grow { flex: 1; }
.wrap { max-width: 1040px; margin: 0 auto; padding: 20px 16px calc(40px + var(--safe-b)); }
.narrow { max-width: 560px; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.between { justify-content: space-between; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; }
.sec-title { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 8px 0 4px; }

/* ---------- boutons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 0 20px; border-radius: 999px; border: 0; background: var(--blue); color: #fff; font-weight: 600; text-decoration: none; transition: transform .15s ease, box-shadow .15s ease, background .15s; }
.btn:hover { background: var(--blue-dk); box-shadow: 0 8px 20px rgba(47,59,255,.25); }
.btn:active { transform: scale(.98); }
.btn[disabled] { opacity: .5; pointer-events: none; }
.btn.ghost { background: var(--white); color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--ink); }
.btn.ghost:hover { background: var(--paper-2); box-shadow: inset 0 0 0 1.5px var(--ink); }
.btn.soft { background: var(--blue-mist); color: var(--blue-dk); }
.btn.soft:hover { background: #d9ddff; box-shadow: none; }
.btn.danger { background: var(--bad-bg); color: var(--bad); }
.btn.danger:hover { background: #fbd5d3; box-shadow: none; }
.btn.small { min-height: 38px; padding: 0 14px; font-size: .9rem; }
.btn.block { width: 100%; }
.icon-btn { width: 44px; height: 44px; border-radius: 12px; border: 0; background: transparent; display: inline-grid; place-items: center; color: var(--ink); }
.icon-btn:hover { background: var(--paper-2); }
.link-btn { background: none; border: 0; color: var(--blue); font-weight: 600; padding: 8px 0; }

/* ---------- cartes ---------- */
.card { background: var(--white); border-radius: var(--r); padding: 18px; box-shadow: 0 1px 0 rgba(13,15,31,.04), inset 0 0 0 1px var(--line); }
.card.flat { box-shadow: inset 0 0 0 1px var(--line); }
.card.blue { background: var(--blue); color: #fff; box-shadow: none; }
.card.blue .muted { color: #E8EAFF; }
.card.tap { display: block; text-decoration: none; color: inherit; transition: transform .15s, box-shadow .15s; }
.card.tap:hover { transform: translateY(-2px); box-shadow: 0 12px 28px rgba(13,15,31,.08), inset 0 0 0 1px var(--line); }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: .82rem; font-weight: 600; background: var(--paper); color: var(--ink-2); }
.pill.blue { background: var(--blue-mist); color: var(--blue-dk); }
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.bad { background: var(--bad-bg); color: var(--bad); }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--blue); display: inline-block; }

/* ---------- formulaires ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-weight: 600; font-size: .92rem; }
.field small { color: var(--muted); }
.input, select.input, textarea.input { width: 100%; min-height: 48px; padding: 12px 14px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--white); outline: none; transition: border-color .15s; }
textarea.input { min-height: 96px; resize: vertical; }
.input:focus { border-color: var(--blue); }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: .92rem; }
.check input { width: 20px; height: 20px; accent-color: var(--blue); margin-top: 2px; flex: none; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.err { color: var(--bad); font-weight: 600; font-size: .92rem; }

/* ---------- onglets ---------- */
.tabs { display: flex; gap: 6px; overflow-x: auto; padding: 4px; background: var(--white); border-radius: 999px; box-shadow: inset 0 0 0 1px var(--line); scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { border: 0; background: none; padding: 10px 16px; border-radius: 999px; font-weight: 600; color: var(--muted); white-space: nowrap; min-height: 42px; }
.tabs button[aria-selected="true"] { background: var(--ink); color: #fff; }

/* ---------- accueil / auth ---------- */
.hero { min-height: 100dvh; display: flex; flex-direction: column; justify-content: center; padding: calc(32px + var(--safe-t)) 20px 40px; max-width: 460px; margin: 0 auto; gap: 22px; }
.hero h1 { font-size: clamp(2.1rem, 9vw, 2.8rem); }
.hero h1 em { font-style: normal; color: var(--blue); }
.seg { display: grid; grid-template-columns: 1fr 1fr; background: var(--white); border-radius: 14px; padding: 4px; box-shadow: inset 0 0 0 1px var(--line); }
.seg button { border: 0; background: none; padding: 10px; border-radius: 10px; font-weight: 600; color: var(--muted); min-height: 42px; }
.seg button.on { background: var(--ink); color: #fff; }

/* ---------- stats ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.stat { background: var(--white); border-radius: 16px; padding: 14px 16px; box-shadow: inset 0 0 0 1px var(--line); }
.stat b { display: block; font: 800 1.7rem/1.1 var(--display); letter-spacing: -.03em; }
.stat span { font-size: .85rem; color: var(--muted); }
.bar { height: 8px; border-radius: 8px; background: var(--paper-2); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 8px; background: var(--blue); transition: width .5s cubic-bezier(.2,.8,.2,1); }
.bar.full > i { background: var(--ok); }

/* ---------- créneaux ---------- */
.day-h { font: 700 1rem var(--display); margin: 18px 0 8px; display: flex; align-items: center; gap: 8px; }
.shift { background: var(--white); border-radius: 16px; padding: 14px 16px; box-shadow: inset 0 0 0 1px var(--line); display: flex; flex-direction: column; gap: 10px; }
.shift.need { box-shadow: inset 0 0 0 1.5px #F2C26B; }
.shift-top { display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; }
.shift-time { font-weight: 700; font-variant-numeric: tabular-nums; }
.seats { display: flex; gap: 6px; flex-wrap: wrap; }
.seat { min-width: 34px; height: 34px; padding: 0 10px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; font-size: .82rem; font-weight: 600; background: var(--paper); color: var(--muted); border: 1.5px dashed #CFCBC2; }
.seat.on { background: var(--blue); color: #fff; border: 0; }
.seat.on button { all: unset; cursor: pointer; margin-left: 6px; opacity: .8; }
.list { display: flex; flex-direction: column; gap: 10px; }

/* inscription publique */
.pick { display: flex; gap: 14px; align-items: center; background: var(--white); border-radius: 16px; padding: 14px 16px; box-shadow: inset 0 0 0 1.5px var(--line); cursor: pointer; transition: box-shadow .15s, background .15s; }
.pick:hover { box-shadow: inset 0 0 0 1.5px #b9bcf5; }
.pick input { width: 24px; height: 24px; accent-color: var(--blue); flex: none; }
.pick.on { box-shadow: inset 0 0 0 2px var(--blue); background: #F7F8FF; }
.pick.off { opacity: .55; cursor: not-allowed; }
.pick .grow { flex: 1; min-width: 0; }
.sticky-cta { position: sticky; bottom: 0; padding: 12px 0 calc(12px + var(--safe-b)); background: linear-gradient(to top, var(--paper) 70%, rgba(245,243,238,0)); }

/* ---------- personnes ---------- */
.person { display: flex; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.person:last-child { border-bottom: 0; }
.avatar { width: 40px; height: 40px; border-radius: 12px; background: var(--blue-mist); color: var(--blue-dk); display: grid; place-items: center; font-weight: 700; flex: none; }
.person .grow { flex: 1; min-width: 0; }
.person .name { font-weight: 600; }

/* ---------- messages ---------- */
.msg { background: var(--white); border-radius: 16px; padding: 14px 16px; box-shadow: inset 0 0 0 1px var(--line); }
.msg .meta { font-size: .82rem; color: var(--muted); margin-bottom: 4px; }
.msg p { white-space: pre-wrap; }

/* ---------- vides ---------- */
.empty { text-align: center; padding: 34px 18px; color: var(--muted); background: var(--white); border-radius: var(--r); box-shadow: inset 0 0 0 1px var(--line); display: flex; flex-direction: column; gap: 12px; align-items: center; }
.empty h3 { color: var(--ink); }

/* ---------- feuille (modale) ---------- */
#sheet:empty { display: none; }
.sheet-bg { position: fixed; inset: 0; background: rgba(13,15,31,.4); z-index: 50; display: flex; align-items: flex-end; justify-content: center; animation: fade .2s ease; }
.sheet { background: var(--paper); width: 100%; max-width: 560px; max-height: 92dvh; overflow-y: auto; border-radius: 26px 26px 0 0; padding: 22px 18px calc(24px + var(--safe-b)); animation: up .28s cubic-bezier(.2,.8,.2,1); display: flex; flex-direction: column; gap: 16px; }
@media (min-width: 700px) { .sheet-bg { align-items: center; } .sheet { border-radius: 26px; } }
.sheet-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
@keyframes fade { from { opacity: 0 } }
@keyframes up { from { transform: translateY(40px); opacity: 0 } }

/* ---------- toasts ---------- */
#toasts { position: fixed; left: 50%; bottom: calc(18px + var(--safe-b)); transform: translateX(-50%); z-index: 80; display: flex; flex-direction: column; gap: 8px; align-items: center; width: max-content; max-width: calc(100vw - 32px); }
.toast { background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 14px; font-weight: 500; box-shadow: 0 12px 30px rgba(13,15,31,.25); animation: up .25s ease; }
.toast.bad { background: var(--bad); }

/* ---------- divers ---------- */
.qr { background: #fff; padding: 14px; border-radius: 16px; width: 220px; height: 220px; display: grid; place-items: center; box-shadow: inset 0 0 0 1px var(--line); }
.qr img { width: 100%; height: 100%; image-rendering: pixelated; }
.copy-box { display: flex; gap: 8px; align-items: center; background: var(--white); border-radius: 14px; padding: 6px 6px 6px 14px; box-shadow: inset 0 0 0 1.5px var(--line); }
.copy-box code { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .9rem; }
.notice { background: var(--blue-mist); color: var(--blue-dk); border-radius: 16px; padding: 14px 16px; font-size: .94rem; }
.notice.warn { background: var(--warn-bg); color: var(--warn); }
.footer { text-align: center; color: var(--muted); font-size: .85rem; padding: 30px 0 10px; }
.org-switch { border: 0; background: var(--white); border-radius: 12px; padding: 8px 12px; font-weight: 600; box-shadow: inset 0 0 0 1px var(--line); max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-height: 42px; }
@keyframes pop { 0% { transform: scale(.6); opacity: 0 } 60% { transform: scale(1.08) } 100% { transform: none; opacity: 1 } }
.pop { animation: pop .5s cubic-bezier(.2,.8,.2,1) both; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
