/* CASIP — compléments de style pour l'espace adhérent et l'administration.
   N'utilise que les variables de la palette de la maquette (--creme, --beige, --taupe-d…). */

/* Pots de miel anti-robots : hors écran, jamais display:none (détecté par les robots récents) */
.hp { position: absolute; left: -10000px; top: auto; width: 1px; height: 1px; overflow: hidden; }

/* Fenêtre générique, même facture que les modales de la maquette */
.ui-modal { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.65); z-index: 10001;
  align-items: center; justify-content: center; padding: 20px; overflow-y: auto; }
.ui-box { background: #fff; border-radius: var(--r2); max-width: 560px; width: 100%; padding: 36px; margin: auto;
  position: relative; box-shadow: 0 20px 60px rgba(0,0,0,.4); }
.ui-x { position: absolute; top: 14px; right: 18px; background: none; border: none; font-size: 1.4rem; color: var(--txt3); cursor: pointer; }
[data-ui="mobile"] .ui-modal { align-items: flex-end; padding: 0; }
[data-ui="mobile"] .ui-box { border-radius: 18px 18px 0 0; padding: 28px 18px calc(24px + env(safe-area-inset-bottom, 0px)); max-height: 92vh; overflow-y: auto; }
[data-ui="mobile"] .ui-box input, [data-ui="mobile"] .ui-box select, [data-ui="mobile"] .ui-box textarea,
[data-ui="mobile"] #mbApp input, [data-ui="mobile"] #mbApp select, [data-ui="mobile"] #mbApp textarea { font-size: 16px; }

/* Espace : menu latéral plus long que l'administration d'origine */
#mbApp, #admApp { min-height: 620px; }
#mbApp .aside, #admApp .aside { padding-bottom: 12px; }
#mbApp .amain, #admApp .amain { min-width: 0; }
.amain h3 { display: flow-root; }
.sp-count:not(:empty) { margin-left: auto; background: var(--accent); color: #fff; border-radius: 50px; font-size: .6rem; padding: 0 7px; }

.sp-intro { font-size: .86rem; color: var(--txt2); margin-bottom: 18px; font-weight: 300; line-height: 1.65; }
.sp-sub { font-size: .68rem; font-weight: 700; letter-spacing: 1.2px; text-transform: uppercase; color: var(--txt2); margin: 4px 0 10px; }
.sp-muted { font-size: .74rem; color: var(--txt3); }
.sp-list { display: flex; flex-direction: column; gap: 14px; }
.sp-actions { display: flex; gap: 7px; flex-wrap: wrap; align-items: center; margin-top: 10px; }
.sp-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 26px; }
.sp-form2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.sp-form2 .fg:has(textarea) { grid-column: 1 / -1; }
.sp-row { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; padding: 10px 0; border-bottom: 1px solid var(--beige); font-size: .84rem; }
.sp-row strong { color: var(--txt); font-weight: 600; flex: 1 1 60%; }
.sp-row span { color: var(--txt3); font-size: .76rem; }
.sp-row a, .sp-alert a { color: var(--taupe-d); font-weight: 600; cursor: pointer; }
.sp-row em { font-style: normal; font-size: .74rem; color: var(--taupe-d); font-weight: 600; }
.sp-alert { background: var(--accent-bg); border: 1px solid var(--accent-bg2); color: var(--txt); border-radius: var(--r2); padding: 12px 16px; margin-bottom: 12px; font-size: .84rem; }
.sp-alert.amb { background: #F4EFE6; border-color: #E2D6BF; }
.sp-table { overflow-x: auto; border: 1px solid var(--beige2); border-radius: var(--r2); background: #fff; }
.sp-table table { white-space: nowrap; }
.sp-table td { vertical-align: top; }
.sp-meta span { color: var(--txt3); }
.sp-st { font-family: var(--sans); font-size: .72rem; border: 1px solid var(--beige2); border-radius: var(--r); padding: 2px 6px; background: var(--creme); color: var(--txt2); }
.forum-thread .ft-foot a, .pfoot a { cursor: pointer; color: var(--taupe-d); }
.sp-replies:not(:empty) { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--beige); }
.sp-x { font-weight: 400; color: var(--txt3); cursor: pointer; font-size: .7rem; }
.sp-event.past { opacity: .72; }
.sp-voters { margin-top: 10px; font-size: .8rem; color: var(--txt2); background: var(--creme); border-radius: var(--r); padding: 10px 14px; }
.sp-docs { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; margin-bottom: 22px; }
.sp-docs .doc-card { flex-wrap: wrap; }
.sp-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; }
.sp-gallery figure { margin: 0; background: #fff; border-radius: var(--r2); overflow: hidden; box-shadow: 0 2px 10px var(--ombre); cursor: pointer; }
.sp-gallery figcaption { padding: 8px 11px; font-size: .78rem; color: var(--txt2); }
.sp-gthumb { height: 130px; display: flex; align-items: center; justify-content: center; font-size: 3rem; overflow: hidden; }
.sp-lb { min-height: 260px; display: flex; align-items: center; justify-content: center; font-size: 6rem; border-radius: var(--r); overflow: hidden; }
.sp-modgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.sp-mod { background: #fff; border: 1px solid var(--beige2); border-radius: var(--r2); overflow: hidden; }
.sp-modb { padding: 12px 14px; font-size: .82rem; }
.sp-modb p { margin-top: 5px; white-space: normal; }

/* Vraies photos dans la bibliothèque (les vignettes de la maquette étaient des emojis) */
.photo-thumb { overflow: hidden; }
.ph-img { width: 100%; height: 100%; object-fit: cover; display: block; }
.lb-img { max-width: 100%; max-height: 70vh; display: block; margin: 0 auto; }

.sp-toast { position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 20px); background: var(--taupe-d); color: #fff;
  padding: 11px 20px; border-radius: 50px; font-size: .84rem; box-shadow: 0 8px 24px var(--ombre2); opacity: 0;
  transition: opacity .25s, transform .25s; z-index: 10002; max-width: calc(100% - 32px); text-align: center; }
.sp-toast.on { opacity: 1; transform: translate(-50%, 0); }
.sp-toast.err { background: var(--accent); }
[data-ui="mobile"] .sp-toast { bottom: calc(74px + env(safe-area-inset-bottom, 0px)); }

@media (max-width: 900px) {
  .sp-grid2, .sp-form2 { grid-template-columns: 1fr; }
  #mbApp, #admApp { grid-template-columns: 1fr; min-height: 0; }
  #mbApp .aside, #admApp .aside { flex-direction: row; flex-wrap: nowrap; overflow-x: auto; padding: 0; border-right: none;
    border-bottom: 1px solid var(--beige2); -webkit-overflow-scrolling: touch; }
  #mbApp .asec, #admApp .asec { display: none; }
  #mbApp .alink, #admApp .alink { padding: 12px 13px; flex-direction: column; gap: 2px; font-size: .6rem; border-left: none;
    border-bottom: 2px solid transparent; white-space: nowrap; }
  #mbApp .alink.on, #admApp .alink.on { border-bottom-color: var(--taupe-l); border-left-color: transparent; }
  #mbApp .alink.out, #admApp .alink.out { margin-top: 0; }
  #mbApp .amain, #admApp .amain { padding: 18px 14px; }
  .ui-box { padding: 28px 18px; }
}

/* Portraits du bureau : photo pleine largeur en haut de la carte (plus de médaillon) */
.tav.tav-photo { height: 300px; padding: 0; overflow: hidden; background: var(--beige); display: block; }
.tav.tav-photo img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 22%; display: block; }
[data-ui="mobile"] .tav.tav-photo { height: 260px; }
.sp-face { width: 52px; height: 52px; border-radius: var(--r); object-fit: cover; object-position: 50% 22%; vertical-align: middle;
  margin-right: 11px; border: 1px solid var(--beige2); display: inline-flex; align-items: center; justify-content: center;
  font-size: 1.3rem; background: var(--beige); float: left; }

/* Menu du haut (défaut de la maquette) : logo + 9 liens = 1 311 px pour 1 120 px disponibles,
   les libellés se repliaient sur 2-3 lignes et débordaient de la barre. Un lien = une ligne. */
[data-ui="desktop"] #nav .nw { max-width: 1360px; }
[data-ui="desktop"] .nav-links li a { white-space: nowrap; }
@media (max-width: 1440px) {
  [data-ui="desktop"] .nav-links li a { padding: 8px 9px; letter-spacing: .5px; }
  [data-ui="desktop"] .logo small { max-width: 250px; line-height: 1.5; }
}
@media (max-width: 1180px) {
  [data-ui="desktop"] .nav-links { display: none; flex-direction: column; position: absolute; top: 62px; left: 0; right: 0;
    background: #fff; border: 1px solid var(--beige2); border-top: none; padding: 10px 12px; z-index: 998; gap: 2px;
    box-shadow: 0 8px 20px var(--ombre); }
  [data-ui="desktop"] .nav-links.open { display: flex; }
  [data-ui="desktop"] .nav-links li a.cta { margin-left: 0; margin-top: 5px; }
  [data-ui="desktop"] .burger { display: flex; }
  [data-ui="desktop"] .logo small { max-width: none; }
}

/* Turnstile : invisible sauf si Cloudflare demande une interaction */
.ts-slot:empty { display: none; }
.ts-slot { margin: 8px 0 12px; }

/* Visionneuse PDF plein écran */
.pv { display: none; position: fixed; inset: 0; z-index: 10003; background: rgba(30,36,51,.92); flex-direction: column; }
.pv-bar { display: flex; align-items: center; gap: 8px; padding: 10px 14px; background: var(--taupe-d); color: #fff; flex-wrap: wrap; }
.pv-t { font-family: var(--serif); font-size: 1.1rem; font-weight: 600; max-width: 55vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pv-n { font-size: .75rem; opacity: .7; }
.pv-sp { flex: 1; }
.pv-bar .ta { background: rgba(255,255,255,.12); border-color: rgba(255,255,255,.25); color: #fff; font-size: .78rem; padding: 5px 10px; }
.pv-pages { flex: 1; overflow: auto; padding: 16px 12px 40px; display: flex; flex-direction: column; align-items: center; gap: 14px; -webkit-overflow-scrolling: touch; }
.pv-p { background: #fff; box-shadow: 0 6px 24px rgba(0,0,0,.35); max-width: none; }
[data-ui="mobile"] .pv-t { max-width: 100%; flex-basis: 100%; }

/* Profil : ma photo */
.sp-me { display: flex; gap: 20px; align-items: flex-start; margin-bottom: 22px; background: #fff; border: 1px solid var(--beige2); border-radius: var(--r2); padding: 18px; }
.sp-me-ph { width: 140px; height: 140px; flex-shrink: 0; border-radius: var(--r2); overflow: hidden; background: var(--beige); display: flex; align-items: center; justify-content: center; font-size: 3rem; }
.sp-me-ph img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 22%; }
/* Annuaire : fiche d'un membre */
.sp-who { font-weight: 600; color: var(--txt); cursor: pointer; border-bottom: 1px dotted var(--taupe-l); }
.sp-who:hover { color: var(--taupe-d); }
.sp-card { display: grid; grid-template-columns: 260px 1fr; gap: 22px; align-items: start; }
.sp-card-ph { width: 100%; aspect-ratio: 1; object-fit: cover; object-position: 50% 22%; border-radius: var(--r2); display: block; }
.sp-card-e { background: var(--beige); display: flex; align-items: center; justify-content: center; font-size: 4rem; }
@media (max-width: 640px) { .sp-card { grid-template-columns: 1fr; } .sp-me { flex-direction: column; } }
