/* ==========================================================================
   Planning v3 — flux d'équipe : tablette de pointage, photos, shifts libres, échanges
   ========================================================================== */

.flows-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
@media (max-width: 900px) { .flows-grid { grid-template-columns: minmax(0, 1fr); } }
.flow-icon { flex: none; width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--bg-muted); color: var(--text-secondary); }

/* --- Tablette de pointage (/pos) ----------------------------------------- */
.pos-page { background: #f6f7fb; overflow-x: hidden; -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; }
.pos-page .cookie-banner, .pos-page .contact-widget { display: none !important; }
.pos { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; color: #0b0d12; font-family: var(--font); padding: max(18px, env(safe-area-inset-top)) max(22px, env(safe-area-inset-right)) max(18px, env(safe-area-inset-bottom)) max(22px, env(safe-area-inset-left)); }
.pos-head { display: flex; align-items: center; gap: 16px; padding-bottom: 18px; }
.pos-brand { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; }
.pos-logo { width: 46px; height: 46px; border-radius: 12px; object-fit: contain; background: #fff; box-shadow: 0 1px 2px rgb(9 9 11 / .06), 0 0 0 1px rgb(9 9 11 / .05); }
.pos-logo-text { display: grid; place-items: center; font-weight: 700; color: #fff; background: #18181b; }
.pos-company { font-weight: 650; font-size: 18px; letter-spacing: -0.01em; }
.pos-device { font-size: 13px; color: #71717a; }
.pos-clock { text-align: right; }
.pos-time { font-size: 34px; font-weight: 650; letter-spacing: -0.03em; line-height: 1; font-variant-numeric: tabular-nums; }
.pos-date { font-size: 13px; color: #71717a; margin-top: 4px; text-transform: capitalize; }
.pos-lock { width: 44px; height: 44px; border-radius: 99px; display: grid; place-items: center; color: #a1a1aa; background: transparent; border: 0; cursor: pointer; }
.pos-lock:active { background: #e4e4e7; color: #3f3f46; }
.pos-offline { display: flex; align-items: center; gap: 8px; justify-content: center; padding: 10px 14px; margin-bottom: 12px; border-radius: 12px; background: #fff7ed; color: #b45309; font-weight: 500; }

.pos-screen { flex: 1; display: flex; flex-direction: column; animation: pos-in .22s ease-out; }
.pos-screen[hidden] { display: none; }
.pos-center { align-items: center; justify-content: center; text-align: center; gap: 18px; }
@keyframes pos-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.pos-search { position: relative; max-width: 560px; width: 100%; margin: 0 auto 18px; color: #a1a1aa; }
.pos-search svg { position: absolute; left: 18px; top: 50%; transform: translateY(-50%); }
.pos-search input { width: 100%; height: 58px; padding: 0 20px 0 52px; font: inherit; font-size: 18px; color: #0b0d12; background: #fff; border: 0; border-radius: 16px; box-shadow: 0 1px 2px rgb(9 9 11 / .05), 0 0 0 1px rgb(9 9 11 / .06); outline: none; -webkit-user-select: text; user-select: text; }
.pos-search input:focus { box-shadow: 0 0 0 3px rgb(46 91 255 / .2), 0 0 0 1px #2e5bff; }

.pos-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; align-content: start; }
.pos-person { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 20px 10px 16px; min-height: 168px; background: #fff; border: 0; border-radius: 20px; cursor: pointer; font: inherit; color: inherit; box-shadow: 0 1px 2px rgb(9 9 11 / .05), 0 0 0 1px rgb(9 9 11 / .05); transition: transform .12s, box-shadow .12s; }
.pos-person:active { transform: scale(.97); box-shadow: 0 0 0 2px #2e5bff; }
.pos-avatar { position: relative; width: 72px; height: 72px; border-radius: 99px; display: grid; place-items: center; font-size: 26px; font-weight: 650; color: #fff; background: var(--c, #2e5bff); letter-spacing: -0.02em; }
.pos-avatar-lg { width: 108px; height: 108px; font-size: 40px; }
.pos-dot { position: absolute; right: 2px; bottom: 2px; width: 18px; height: 18px; border-radius: 99px; border: 3px solid #fff; background: #d4d4d8; }
.is-in .pos-dot { background: #16a34a; }
.is-break .pos-dot { background: #f59e0b; }
.pos-name { font-weight: 600; font-size: 16px; line-height: 1.2; max-width: 100%; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.pos-state { font-size: 12.5px; color: #71717a; }
.is-in .pos-state { color: #15803d; }
.is-break .pos-state { color: #b45309; }
.pos-empty { text-align: center; color: #71717a; padding: 40px; font-size: 16px; }

.pos-who { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.pos-who-name { font-size: 26px; font-weight: 650; letter-spacing: -0.02em; }
.pos-prompt { font-size: 17px; color: #52525b; max-width: 480px; }
.pos-dots { display: flex; gap: 16px; height: 22px; align-items: center; }
.pos-dots i { width: 18px; height: 18px; border-radius: 99px; border: 2px solid #a1a1aa; transition: background .1s, border-color .1s; }
.pos-dots i.on { background: #0b0d12; border-color: #0b0d12; }
.pos-dots.shake { animation: pos-shake .38s; }
@keyframes pos-shake { 20%, 60% { transform: translateX(-10px); } 40%, 80% { transform: translateX(10px); } }
.pos-error { min-height: 22px; color: #dc2626; font-weight: 500; }
.pos-keypad { display: grid; grid-template-columns: repeat(3, 92px); gap: 14px; }
.pos-keypad button { height: 92px; border-radius: 99px; border: 0; background: #fff; font: inherit; font-size: 32px; font-weight: 500; color: #0b0d12; cursor: pointer; box-shadow: 0 1px 2px rgb(9 9 11 / .06), 0 0 0 1px rgb(9 9 11 / .06); display: grid; place-items: center; }
.pos-keypad button:active { background: #e4e4e7; transform: scale(.96); }
.pos-keypad .pos-key-ghost { background: transparent; box-shadow: none; font-size: 16px; color: #52525b; }
@media (max-height: 760px) { .pos-keypad { grid-template-columns: repeat(3, 76px); gap: 10px; } .pos-keypad button { height: 76px; font-size: 28px; } .pos-avatar-lg { width: 80px; height: 80px; font-size: 30px; } }

.pos-actions { display: flex; flex-wrap: wrap; gap: 16px; justify-content: center; width: 100%; max-width: 720px; margin-top: 8px; }
.pos-btn { flex: 1 1 260px; min-height: 104px; padding: 0 28px; border: 0; border-radius: 24px; font: inherit; font-size: 26px; font-weight: 650; letter-spacing: -0.01em; color: #fff; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; text-decoration: none; transition: transform .1s; }
.pos-btn:active { transform: scale(.97); }
.pos-btn-success { background: #16a34a; box-shadow: 0 10px 24px -10px rgb(22 163 74 / .7); }
.pos-btn-warning { background: #f59e0b; box-shadow: 0 10px 24px -10px rgb(245 158 11 / .7); }
.pos-btn-dark { background: #18181b; box-shadow: 0 10px 24px -10px rgb(9 9 11 / .6); }
.pos-unlock-ok { flex: none; min-height: 64px; min-width: 240px; font-size: 20px; }
.pos-link { background: none; border: 0; font: inherit; font-size: 16px; color: #71717a; padding: 14px; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }

.pos-camera { position: relative; width: min(480px, 80vw); aspect-ratio: 4 / 3; border-radius: 28px; overflow: hidden; background: #18181b; box-shadow: 0 24px 48px -16px rgb(9 9 11 / .35); }
.pos-camera video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
.pos-camera-live { width: min(360px, 70vw); margin: 4px auto 20px; border-radius: 24px; }
.pos-flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; }
.pos-flash.on { animation: pos-flash .35s ease-out; }
@keyframes pos-flash { from { opacity: .9; } to { opacity: 0; } }

.pos-done-icon { width: 128px; height: 128px; border-radius: 99px; display: grid; place-items: center; color: #fff; background: #16a34a; animation: pos-check .4s cubic-bezier(.2, 1.4, .4, 1); }
.pos-done-icon.is-pause { background: #f59e0b; }
.pos-done-icon.is-out { background: #18181b; }
@keyframes pos-check { from { transform: scale(.4); opacity: 0; } to { transform: none; opacity: 1; } }
.pos-done-title { font-size: 30px; font-weight: 650; letter-spacing: -0.02em; max-width: 680px; }
.pos-done-time { font-size: 20px; color: #71717a; }
.pos-spinner { width: 52px; height: 52px; border-radius: 99px; border: 4px solid #e4e4e7; border-top-color: #2e5bff; animation: pos-spin .8s linear infinite; }
@keyframes pos-spin { to { transform: rotate(360deg); } }
.pos-unpaired { justify-content: center; }
.pos-unpaired .pos-btn { flex: none; min-height: 64px; font-size: 18px; margin-top: 10px; }

/* --- Photos de pointage ---------------------------------------------------- */
.punch-thumbs { display: inline-flex; gap: 3px; vertical-align: middle; margin-left: 6px; }
.punch-thumb { width: 26px; height: 26px; border-radius: 7px; overflow: hidden; padding: 0; border: 1px solid var(--border); background: var(--bg-muted); cursor: zoom-in; }
.punch-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.lightbox { padding: 0; border: 0; background: transparent; max-width: min(92vw, 720px); }
.lightbox::backdrop { background: rgb(9 9 11 / .72); }
.lightbox img { display: block; width: 100%; border-radius: 16px; }
.lightbox figcaption { color: #fff; text-align: center; padding: 10px; font-size: 14px; }
.badge-auto { color: var(--warning-text); background: var(--warning-soft); }

/* --- Shifts libres --------------------------------------------------------- */
.planning-grid > .pl-open > div { border-bottom: 1px solid var(--border); border-right: 1px solid var(--border); }
.planning-grid > .pl-open > div:last-child { border-right: 0; }
.pl-open .pl-person { gap: 10px; background: color-mix(in srgb, var(--primary) 4%, var(--bg)); }
.planning-week .pl-open .pl-person { background: color-mix(in srgb, var(--primary) 4%, var(--bg)); }
.pl-open-icon { flex: none; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; color: var(--primary-text); background: var(--primary-soft); }
.pl-open-title { font-weight: 600; font-size: 13px; line-height: 1.2; }
.pl-open-cell { min-height: 52px; }
.planning-grid > .pl-open > div { border-bottom-width: 2px; }
.pl-open-cell.is-creatable { cursor: pointer; }
.open-shift { position: relative; z-index: 1; display: flex; flex-direction: column; gap: 2px; width: 100%; padding: 5px 8px; text-align: left; border-radius: 8px; font-size: 12px; line-height: 1.3; border: 1px dashed color-mix(in srgb, var(--c, var(--primary)) 70%, transparent); background: color-mix(in srgb, var(--c, var(--primary)) 8%, var(--bg)); color: var(--text); text-decoration: none; transition: background .12s, border-color .12s; }
.open-shift:hover { background: color-mix(in srgb, var(--c, var(--primary)) 14%, var(--bg)); border-color: var(--c, var(--primary)); }
.open-shift .t { font-weight: 600; font-variant-numeric: tabular-nums; }
.open-shift .s { color: var(--text-muted); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.open-shift.is-full { border-style: solid; opacity: .65; }
.open-dots { display: flex; align-items: center; gap: 3px; margin-top: 1px; }
.open-dots i { width: 7px; height: 7px; border-radius: 50%; border: 1.5px solid var(--c, var(--primary)); }
.open-dots i.on { background: var(--c, var(--primary)); }
.open-dots b { margin-left: 3px; font-size: 10.5px; font-weight: 600; color: var(--text-muted); font-variant-numeric: tabular-nums; }
/* « + Shift libre » : discret, il apparaît au survol du jour ; la case entière est cliquable quand elle est vide. */
.open-add { display: flex; align-items: center; justify-content: center; gap: 4px; width: 100%; min-height: 26px; padding: 3px 6px; font: inherit; font-size: 11.5px; font-weight: 500; color: var(--text-muted); background: transparent; border: 1px dashed transparent; border-radius: 8px; cursor: pointer; opacity: 0; transition: opacity .12s, color .12s, border-color .12s, background .12s; }
.open-add:only-child { position: absolute; inset: 5px; width: auto; min-height: 0; }
.pl-open-cell:hover .open-add, .open-add:focus-visible { opacity: 1; border-color: var(--border-strong); }
.open-add:hover { color: var(--primary-text); border-color: var(--primary); background: var(--primary-soft); }
@media (hover: none) { .open-add { opacity: 1; border-color: var(--border); } }
.open-card { display: flex; align-items: center; gap: 14px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.open-card:last-child { border-bottom: 0; }
.open-date { flex: none; width: 56px; text-align: center; border-radius: 12px; padding: 6px 0; background: var(--primary-soft); color: var(--primary-text); }
.open-date b { display: block; font-size: 20px; line-height: 1.1; }
.open-date span { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }
.open-progress { display: inline-block; width: 60px; height: 6px; border-radius: 99px; background: var(--bg-muted); overflow: hidden; vertical-align: middle; }
.open-progress i { display: block; height: 100%; background: var(--success); border-radius: 99px; }
.open-takers { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.open-taker { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 3px; font-size: 12.5px; border-radius: 99px; background: var(--bg-muted); border: 1px solid var(--border); }
.open-taker.is-empty { padding: 3px 10px; color: var(--text-faint); background: transparent; border-style: dashed; }
.btn-take { min-width: 140px; }

/* --- Échanges -------------------------------------------------------------- */
.swap-shift { display: inline-flex; flex-direction: column; padding: 6px 10px; border-radius: 9px; border-left: 3px solid var(--c, var(--primary)); background: var(--bg-subtle); font-size: 12.5px; }
.swap-shift b { font-variant-numeric: tabular-nums; }
.swap-arrow { color: var(--text-faint); margin: 0 6px; }
