/* Cartes professionnelles, développé par Yohan Mautailla */
:root { --app-bg: #f4f5f7; }
html, body { min-height: 100%; }
body { background: var(--app-bg); color: #1f2430; -webkit-tap-highlight-color: transparent; }
.bg-app { background: var(--app-bg); }
.btn, .form-control, .form-select { border-radius: 10px; }

/* Pages simples (connexion, mot de passe, installation) */
.simple-wrap { min-height: 100vh; display: flex; flex-direction: column; justify-content: center; align-items: center; padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom)); }
.simple-wrap > * { width: 100%; max-width: 420px; }
.simple-wrap > .panel-wide { max-width: 760px; }
.panel { background: #fff; border-radius: 16px; padding: 28px 24px; box-shadow: 0 2px 14px rgba(20, 30, 50, .07); }
.panel-flat { background: #fff; border-radius: 14px; padding: 20px; border: 1px solid #e7e9ee; }
.form-narrow { max-width: 640px; }
.login-logo { max-height: 64px; max-width: 70%; object-fit: contain; }

/* Administration */
.admin-nav .nav-link-s { color: #44506a; text-decoration: none; font-size: .95rem; }
.admin-nav .nav-link-s:hover { color: #000; }
.stat { background: #fff; border: 1px solid #e7e9ee; border-radius: 14px; padding: 18px; }
.stat-n { font-size: 2rem; font-weight: 700; line-height: 1; }
.stat-l { color: #6b7385; font-size: .9rem; margin-top: 6px; }
.thumb { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; display: inline-block; background: #e7e9ee; }
.recap dt { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: #6b7385; margin-top: 10px; }
.recap dd { margin: 2px 0 0; font-size: 1.15rem; }
.recap code { font-size: 1.15rem; color: #111; background: #f1f3f7; padding: 2px 8px; border-radius: 6px; user-select: all; }
.preview-stage { display: flex; justify-content: center; padding: 8px 0; }

/* Installateur */
.checks li { display: flex; gap: 10px; padding: 5px 0; align-items: flex-start; font-size: .93rem; }
.checks .dot { flex: 0 0 12px; height: 12px; border-radius: 50%; margin-top: 5px; background: #bbb; }
.check-ok .dot { background: #1f9d55; } .check-warn .dot { background: #e0a100; } .check-fail .dot { background: #d93025; } .check-wait .dot { background: #999; }
.check-fail { color: #b3261e; }

/* Page carte salarié (mobile d'abord) */
.card-page { min-height: 100vh; min-height: 100dvh; }
.card-wrap { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px;
  padding: max(18px, env(safe-area-inset-top)) 16px max(18px, env(safe-area-inset-bottom)); }
.card-wrap > .alert { width: 100%; max-width: 360px; }
.card-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }

/* La carte professionnelle */
.card-pro { width: min(100%, 360px); background: #fff; border-radius: 24px; overflow: hidden; box-shadow: 0 10px 34px rgba(20, 30, 50, .16);
  display: flex; flex-direction: column; text-align: center; }
.card-pro__top { background: var(--c1); color: var(--c1t); min-height: 214px; display: flex; align-items: center; justify-content: center; padding: 18px 20px 92px; }
.card-pro__logo { display: inline-flex; background: transparent; }
.card-pro__logo img { max-height: 104px; max-width: 280px; object-fit: contain; display: block; }
.card-pro__brand { font-weight: 700; font-size: 1.3rem; letter-spacing: .02em; }
.card-pro__photo { width: 168px; height: 168px; margin: -86px auto 0; border-radius: 50%; border: 6px solid #fff; background: #e9ecf2; overflow: hidden;
  display: flex; align-items: center; justify-content: center; box-shadow: 0 4px 16px rgba(0, 0, 0, .15); position: relative; }
.card-pro__photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card-pro__photo span { font-size: 2.6rem; font-weight: 700; color: #8a93a6; }
.card-pro__body { padding: 20px 24px 28px; }
.card-pro__name { font-size: 1.6rem; line-height: 1.15; margin: 0 0 6px; font-weight: 400; overflow-wrap: anywhere; }
.card-pro__name strong { font-weight: 700; }
.card-pro__job { color: var(--c2); font-weight: 600; font-size: 1.05rem; margin: 0; overflow-wrap: anywhere; }
.card-pro__rule { width: 48px; height: 3px; background: var(--c2); opacity: 1; border: 0; border-radius: 2px; margin: 18px auto; }
.card-pro__contract p { margin: 0 0 4px; color: #6b7385; font-size: .85rem; }
.card-pro__contract strong { color: #1f2430; font-weight: 600; font-size: .95rem; margin-left: 4px; }
@media (display-mode: standalone) { .card-pro { box-shadow: 0 6px 24px rgba(20, 30, 50, .14); } }

/* Aperçu dynamique + filtres */
.preview-sticky { position: sticky; top: 16px; }
.thumb-empty { display: inline-flex; align-items: center; justify-content: center; font-size: .72rem; font-weight: 700; color: #8a93a6; }
.assoc-filter { position: relative; }
.assoc-filter summary { list-style: none; cursor: pointer; user-select: none; }
.assoc-filter summary::-webkit-details-marker { display: none; }
.assoc-filter[open] .assoc-list { position: absolute; z-index: 30; top: calc(100% + 4px); left: 0; min-width: 320px; max-height: 340px; overflow: auto;
  background: #fff; border: 1px solid #dee2e6; border-radius: 12px; padding: 10px 12px 4px; overflow-x: hidden; box-shadow: 0 10px 30px rgba(20, 30, 50, .15); }
.assoc-list .form-check { display: flex; gap: 8px; align-items: flex-start; margin: 0 0 6px; padding: 0; min-height: 0; }
.assoc-list .form-check .form-check-input { float: none; margin: .2rem 0 0; flex: 0 0 auto; }
.assoc-list .form-check-label { cursor: pointer; }
.assoc-search-wrap { position: sticky; top: -10px; margin: -10px -12px 8px; padding: 10px 12px 8px; background: #fff; border-bottom: 1px solid #eef0f3; z-index: 1; }

/* Page carte : outils, message de confidentialité, masque */
.card-tools { text-align: center; }
.card-pro { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.card-pro img { pointer-events: none; -webkit-user-drag: none; }
.privacy-shield { display: none; }
body.shielded .card-wrap { visibility: hidden; }
body.shielded .privacy-shield { display: flex; position: fixed; inset: 0; z-index: 9999; align-items: center; justify-content: center; text-align: center; background: var(--app-bg); color: #1f2430; padding: 24px; }
@media print { body[data-private] * { display: none !important; } }

/* Résultats filtrés */
#emp-results { transition: opacity .15s; }
#emp-results.is-loading { opacity: .5; pointer-events: none; }

/* Ligne de filtres de la liste des salariés : la recherche occupe toute la largeur restante */
.emp-filters { display: flex; flex-wrap: wrap; align-items: flex-start; gap: .5rem; }
.emp-f-search { flex: 1 1 260px; min-width: 200px; }
.emp-f-select { flex: 0 0 210px; max-width: 100%; }

/* Case du tableau de bord cliquable */
.stat-link { display: block; color: inherit; text-decoration: none; transition: border-color .15s, box-shadow .15s; }
.stat-link:hover, .stat-link:focus-visible { border-color: #9aa6bf; box-shadow: 0 2px 10px rgba(20, 30, 50, .1); color: inherit; }

/* Champ « Association » du formulaire salarié (liste avec recherche) */
.combo { position: relative; }
.combo-btn { text-align: left; width: 100%; }
.combo-panel { position: absolute; z-index: 40; left: 0; right: 0; top: calc(100% + 4px); background: #fff; border: 1px solid #dee2e6; border-radius: 12px; padding: 8px; box-shadow: 0 10px 30px rgba(20, 30, 50, .15); }
.combo-list { list-style: none; margin: 8px 0 0; padding: 0; max-height: 260px; overflow-y: auto; }
.combo-opt { padding: 6px 10px; border-radius: 8px; cursor: pointer; }
.combo-opt:hover, .combo-opt.is-active { background: #eef3ff; }
.combo-opt.is-selected { font-weight: 600; }
.combo-empty { padding: 6px 10px; }

/* Avertissement avant la prise de photo (une seule prise possible) */
.selfie-warning { max-width: 360px; margin: 10px auto 0; padding: 12px 14px; border: 1px solid #ecd48a; background: #fff7e0; border-radius: 12px; color: #5c4a00; font-size: .88rem; text-align: center; }
.selfie-warning p { margin: 0 0 8px; }
.selfie-warning-title { font-weight: 700; }

/* Contrôle de la photo avant validation */
.selfie-preview { max-width: 360px; margin: 10px auto 0; text-align: center; }
.selfie-preview img { width: 160px; height: 160px; border-radius: 50%; object-fit: cover; border: 5px solid #fff; box-shadow: 0 4px 16px rgba(0, 0, 0, .15); background: #e9ecf2; }
.selfie-preview-help { font-size: .85rem; color: #444; margin: 10px 0; }

/* Tableau des salariés : les boutons d'action passent à la ligne au lieu de faire déborder le tableau */
.emp-table > :not(caption) > * > * { padding: .55rem .6rem; }
.emp-actions { display: flex; flex-wrap: wrap; gap: .3rem; max-width: 440px; align-items: center; }
.emp-actions form { margin: 0; display: block; }
.emp-actions .btn { white-space: nowrap; }


/* Fiche d'accès : impression */
.print-only { display: none; }
@media print { nav.admin-nav, .no-print { display: none !important; } .print-only { display: block !important; } body.bg-app { background: #fff; } .panel-flat { border: 0; } }

/* Mots de passe masqués avec oeil */
.pw-wrap { position: relative; display: block; }
.pw-wrap > .form-control { padding-right: 2.75rem; }
.pw-wrap input::-ms-reveal, .pw-wrap input::-ms-clear { display: none; }
.eye-btn { display: inline-flex; align-items: center; justify-content: center; border: 0; background: transparent; color: #6b7385; padding: 0; cursor: pointer; }
.eye-btn:hover, .eye-btn:focus-visible { color: #111; }
.pw-wrap > .eye-btn { position: absolute; top: 0; bottom: 0; right: 0; width: 2.75rem; }
.input-group > .pw-wrap { flex: 1 1 auto; width: 1%; min-width: 0; }
.input-group > .pw-wrap > .form-control { width: 100%; border-top-right-radius: 0; border-bottom-right-radius: 0; }
.input-group > .pw-wrap.has-invalid ~ .invalid-feedback { display: block; }
@media print { .eye-btn { display: none !important; } }
.pw-wrap > .form-control.is-invalid { background-image: none; }

/* Messages de confirmation : fondu */
.alert-success[role="status"] { transition: opacity .6s ease; }
.alert-success[role="status"].alert-fade { opacity: 0; }

/* Fenetre de confirmation */
.cfm-back { position: fixed; inset: 0; background: rgba(17, 24, 39, .45); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 2000; }
.cfm-box { background: #fff; border-radius: 14px; padding: 22px 24px; max-width: 440px; width: 100%; box-shadow: 0 20px 50px rgba(0, 0, 0, .25); }
.cfm-box p { margin: 0 0 18px; }
.cfm-actions { display: flex; justify-content: flex-end; gap: .5rem; }

/* Fiche d'acces imprimee : meme visuel que le PDF */
.ps { display: none; }
@media print {
  @page recap { size: A4; margin: 0; }
  body.ps-printing > *:not(.ps) { display: none !important; }
  body.ps-printing { background: #fff !important; margin: 0 !important; padding: 0 !important; }
  body.ps-printing .ps { display: block; page: recap; width: 210mm; height: 297mm; overflow: hidden; font-family: Helvetica, Arial, sans-serif; color: #000; -webkit-print-color-adjust: exact; print-color-adjust: exact; line-height: 1.2; }
  .ps-band { background: #007632; color: #fff; height: 90pt; padding: 26pt 40pt 0; box-sizing: border-box; }
  .ps-title { font-size: 22pt; font-weight: 700; line-height: 1.1; }
  .ps-company { font-size: 11pt; margin-top: 8pt; color: #ebf0f7; }
  .ps-body { padding: 0 40pt; }
  .ps-name { font-size: 18pt; font-weight: 700; margin-top: 28pt; }
  .ps-role { font-size: 11pt; color: #6b7385; margin-top: 4pt; }
  .ps-label { font-size: 9pt; color: #6b7385; margin-top: 30pt; }
  .ps-val { background: #f1f3f7; height: 30pt; line-height: 30pt; padding: 0 10pt; font-size: 14pt; font-weight: 700; margin-top: 6pt; }
  .ps-h { font-size: 12pt; font-weight: 700; margin-top: 30pt; }
  .ps-step { font-size: 11pt; margin-top: 7pt; }
  .ps-warn { background: #fff7e0; padding: 12pt 10pt; font-size: 10pt; margin-top: 26pt; line-height: 1.7; }
  .ps-foot { font-size: 9pt; color: #6b7385; margin-top: 220pt; }
}
/* Largeurs de la table des associations (les attributs style="" en ligne sont bloqués par la politique CSP) */
.assoc-col-code{width:130px}.assoc-col-count{width:90px}.assoc-code-input{max-width:120px}
