/* ════════════════════════════════════════════════════════════════
   MODULE « appli-mobile » — sur téléphone, l'app ressemble à une application
   Notice : modules/appli-mobile/README.md
   Tout est sous 600 px de large : l'ordinateur et la tablette ne changent pas.
   ════════════════════════════════════════════════════════════════ */
.pop-mob{display:none}

@media(max-width:600px){
  /* ── gestes d'appli : pas de surlignage bleu au toucher, pas de zoom au double toucher,
        pas de sélection de texte sur les boutons, pas de zoom d'iPhone en tapant (champs à 16 px) ── */
  #app{-webkit-tap-highlight-color:transparent}
  #app :is(button,a){touch-action:manipulation;-webkit-user-select:none;user-select:none}   /* pas la carte : son glissement au doigt reste réglé par .deck (pan-y) */
  #app :is(input,textarea,select){font-size:16px}

  /* ── barre du haut épurée : le logo et la pastille du compte, c'est tout ──
        (mode sombre et déconnexion passent dans la fenêtre du compte) */
  /* pas de flou sur la barre : il enfermait la fenêtre du compte (et son fond cliquable) dans la barre */
  #app .sb,html[data-theme="clair"] #app .sb{padding:8px 16px;backdrop-filter:none;-webkit-backdrop-filter:none}
  #app .sb{background:rgba(10,15,26,.97);z-index:20}   /* au-dessus de la barre d'onglets du bas : la fenêtre du compte la recouvre */
  html[data-theme="clair"] #app .sb{background:#F7FAFE}
  #app .sb .backlink,#app .sb #themeBtn{display:none}
  /* espace école : sa fenêtre du compte n'a pas la ligne « Mode sombre », le bouton soleil / lune reste dans la barre */
  #app:has(#amain.ee) .sb #themeBtn{display:flex}
  #app .quota{padding:0;border:0;background:none;box-shadow:none;gap:0}
  #app .quota .q-pill,#app .quota .chev{display:none}
  #app .quota .avatar{width:36px;height:36px}

  /* ── compte : fenêtre qui glisse du bas, avec une poignée ── */
  #app .backdrop{background:rgba(5,9,18,.45)}
  #app .pop{top:auto;bottom:0;left:0;right:0;border-radius:22px 22px 0 0;max-height:86dvh;
    padding-bottom:env(safe-area-inset-bottom);animation:am-monte .24s cubic-bezier(.3,.7,.3,1)}
  #app .pop::before{content:"";display:block;width:38px;height:5px;border-radius:3px;background:var(--muted-2);opacity:.5;margin:8px auto 0}
  #app .pop-f{flex-direction:column;gap:2px;padding:8px 12px 12px}
  #app .pop-f button{text-align:left;font-size:15px;padding:13px 10px;color:var(--ink)}
  #app .pop-f button.pop-mob{display:flex;align-items:center;justify-content:space-between}
  #app .pop-f button.pop-mob span{color:var(--muted);font-size:13px}
  #app .pop:not(.notif) .pop-f button:last-child{color:var(--ko)}   /* « Se déconnecter » en rouge (pas « Régler les alertes » des notifications) */

  /* ── onglets du fil : un sélecteur à 3 cases qui tient toujours dans l'écran ── */
  #app .atabs:not([id]){margin:10px 16px 2px;padding:3px;gap:2px;border:0;border-radius:12px;background:rgba(255,255,255,.07);overflow:visible}
  #app .atabs:not([id]) button{flex:1 1 0;min-width:0;min-height:38px;justify-content:center;gap:5px;padding:7px 4px;margin:0;
    border:0;border-radius:9px;font-size:13px;box-shadow:none}
  #app .atabs:not([id]) button.on{background:rgba(255,255,255,.12);box-shadow:0 1px 3px rgba(0,0,0,.25)}
  #app .atabs:not([id]) .t-long{display:none}
  #app .atabs:not([id]) .t-court{display:inline}
  #app .atabs:not([id]) .n{min-width:0;padding:1px 6px;font-size:11px;border-radius:7px}
  /* « 3 à finaliser » devient un point rouge à côté du nombre */
  #app .atabs:not([id]) .todo-tag{font-size:0;width:7px;height:7px;padding:0;border:0;border-radius:50%;background:var(--ko);flex:0 0 auto}
  html[data-theme="clair"] #app .atabs:not([id]){background:rgba(17,26,43,.06)}
  html[data-theme="clair"] #app .atabs:not([id]) button.on{background:#fff;box-shadow:0 1px 3px rgba(17,26,43,.14);border:0}

  /* ── filtres : un seul bouton qui résume la recherche (la fenêtre du bas est plus loin) ── */
  #app .fbar.fbar-mob{display:block;overflow:visible;padding:8px 16px 2px}
  #app .fsum{display:flex;align-items:center;gap:11px;width:100%;min-height:50px;padding:6px 16px;border-radius:16px;
    border:1px solid rgba(150,172,208,.22);background:rgba(255,255,255,.04);color:var(--ink);font:500 14px var(--fb);cursor:pointer}
  #app .fsum svg{width:16px;height:16px;color:var(--cobalt);flex:0 0 auto}
  #app .fsum span{flex:1;min-width:0;text-align:left;display:flex;flex-direction:column;gap:1px}
  #app .fsum b{font-weight:600;font-size:14px;line-height:1.3}
  #app .fsum small{font-size:12.5px;color:var(--muted);line-height:1.3}
  html[data-theme="clair"] #app .fsum small{color:#4A5C7C}
  #app .fsum .fcar{width:6px;height:6px;border-right:1.5px solid var(--muted);border-bottom:1.5px solid var(--muted);transform:translateY(-2px) rotate(45deg);flex:0 0 auto}
  html[data-theme="clair"] #app .fsum{background:#E3F0FF;border-color:transparent;color:#0E1E38}
  html[data-theme="clair"] #app .fsum svg{color:#083F7E}
}

/* ── fenêtres du bas « Ta recherche » (#fsheet, filtres) et « Télécharger » (#pchoix, page de candidature),
      ouvertes seulement sur téléphone ── */
:is(#fsheet,#pchoix){position:fixed;inset:0;z-index:470}
:is(#fsheet,#pchoix) .fs-fond{position:absolute;inset:0;background:rgba(5,9,18,.45)}
:is(#fsheet,#pchoix) .fs-panneau{position:absolute;left:0;right:0;bottom:0;max-height:90dvh;overflow-y:auto;background:#101827;border-radius:22px 22px 0 0;
  padding:8px 18px 0;box-shadow:0 -20px 60px -20px rgba(0,0,0,.6);transform:translateY(100%);transition:transform .24s cubic-bezier(.3,.7,.3,1)}
/* arrivée par une transition (et non une animation) : si elle ne se joue pas, la fenêtre s'affiche quand même */
:is(#fsheet,#pchoix).ouvert .fs-panneau{transform:none}
:is(#fsheet,#pchoix) .fs-poignee{width:38px;height:5px;border-radius:3px;background:var(--muted-2);opacity:.5;margin:0 auto 12px}
:is(#fsheet,#pchoix) .fs-titre{font-family:var(--fd);font-size:19px;font-weight:500;color:var(--ink);margin-bottom:4px}
:is(#fsheet,#pchoix) .fs-lab{display:block;font-size:12.5px;color:var(--muted);margin:14px 0 6px}
:is(#fsheet,#pchoix) .fld input{width:100%;height:46px;font-size:16px}
:is(#fsheet,#pchoix) .fs-km{display:grid;grid-template-columns:repeat(4,1fr);gap:6px}
:is(#fsheet,#pchoix) .fs-km button{height:42px;border-radius:12px;border:1px solid var(--line);background:none;color:var(--ink);font:500 14px var(--fb);cursor:pointer;-webkit-tap-highlight-color:transparent}
:is(#fsheet,#pchoix) .fs-km button.on{background:var(--cobalt);border-color:var(--cobalt);color:var(--light-ink)}
/* « Voir les offres » collé en bas de la fenêtre : toujours visible, même quand elle défile */
:is(#fsheet,#pchoix) .fs-pied{position:sticky;bottom:0;margin:10px -18px 0;padding:10px 18px calc(18px + env(safe-area-inset-bottom));background:inherit}
:is(#fsheet,#pchoix) .fs-go{width:100%;height:50px;border:0;border-radius:14px;background:var(--grad-cta);color:var(--light-ink);font:600 15px var(--fb);cursor:pointer;-webkit-tap-highlight-color:transparent}
html[data-theme="clair"] :is(#fsheet,#pchoix) .fs-panneau{background:#fff;box-shadow:0 -20px 60px -24px rgba(17,26,43,.35)}
html[data-theme="clair"] :is(#fsheet,#pchoix) .fs-km button.on{background:#0B5398;border-color:#0B5398;color:#fff}
html[data-theme="clair"] :is(#fsheet,#pchoix) .fs-go{color:#fff}   /* dégradé bleu marine en mode clair : texte blanc */
/* un champ a le curseur (clavier ouvert) : la fenêtre se place en haut de l'écran, au-dessus du clavier
   (top et max-height donnés par appli-mobile.js d'après la partie visible de l'écran) */
:is(#fsheet,#pchoix) .fs-panneau.fs-clavier{top:8px;bottom:auto;left:8px;right:8px;border-radius:22px;transition:none}
:is(#fsheet,#pchoix) .fs-clavier :is(.fs-poignee,.fs-titre){display:none}   /* place gagnée : tout tient au-dessus du clavier */
:is(#fsheet,#pchoix) .fs-clavier{padding-top:2px}
:is(#fsheet,#pchoix) .fs-clavier .fs-lab{margin:10px 0 5px}
:is(#fsheet,#pchoix) .fs-clavier .fld input{height:42px}
:is(#fsheet,#pchoix) .fs-clavier .fs-km button{height:38px}
:is(#fsheet,#pchoix) .fs-clavier .fs-pied{padding-bottom:14px;border-radius:0 0 22px 22px}

/* appli ouverte : la page d'accueil derrière est masquée et le fond prend la couleur de l'appli
   (sur le Safari d'iOS 26, elle se voyait sous la barre d'adresse flottante et sous l'heure) */
html:has(#app.on),body:has(#app.on){background:#070B14}
html[data-theme="clair"]:has(#app.on),html[data-theme="clair"]:has(#app.on) body{background:#F4F6FA}
body:has(#app.on) #site{visibility:hidden}
@keyframes am-monte{from{transform:translateY(100%)}to{transform:none}}

/* ── page de candidature (téléphone) ── */
@media(max-width:600px){
  /* en-tête façon appli : « ‹ Retour » au-dessus, puis le titre de l'offre en entier */
  #app .am:has(#prepTabs,#sdTabs) .ahead > div{flex-direction:column;align-items:flex-start !important;gap:6px !important;min-width:0;width:100%}
  #app .am:has(#prepTabs,#sdTabs) .ahead > div > div{min-width:0;max-width:100%}
  #app .am:has(#prepTabs,#sdTabs) .ahead h2{white-space:normal;font-size:20px;line-height:1.25}
  html[data-theme="clair"] #app .am:has(#prepTabs,#sdTabs) .ahead h2{width:auto}
  #app .am:has(#prepTabs,#sdTabs) .ahead p{white-space:normal}
  #app .am:has(#prepTabs,#sdTabs) .ahead .round{width:auto !important;height:32px !important;border:0;background:none;box-shadow:none;padding:0 6px 0 0;
    border-radius:8px;gap:2px;color:var(--cobalt);font:600 15px var(--fb)}
  #app .am:has(#prepTabs,#sdTabs) .ahead .round svg{color:var(--cobalt) !important;width:20px !important;height:20px !important}
  #app .am:has(#prepTabs,#sdTabs) .ahead .round::after{content:"Retour"}
  html[data-theme="clair"] #app .am:has(#prepTabs,#sdTabs) .ahead .round,html[data-theme="clair"] #app .am:has(#prepTabs,#sdTabs) .ahead .round svg{color:#0B5398 !important}

  /* onglets Mon CV / CV adapté / Lettre : sélecteur à 3 cases, comme le fil */
  #app :is(#prepTabs,#sdTabs){margin:10px 16px 6px;padding:3px !important;gap:2px;border:0;border-radius:12px;background:rgba(255,255,255,.07);overflow:visible}
  #app :is(#prepTabs,#sdTabs) button{flex:1 1 0;min-width:0;min-height:38px;justify-content:center;gap:5px;padding:7px 4px !important;margin:0;
    border:0;border-radius:9px;font-size:13.5px !important;box-shadow:none}
  #app :is(#prepTabs,#sdTabs) button.on{background:rgba(255,255,255,.12);box-shadow:0 1px 3px rgba(0,0,0,.25)}
  #app :is(#prepTabs,#sdTabs) .t-long{display:none}
  #app :is(#prepTabs,#sdTabs) .t-court{display:inline}
  /* état de la rédaction : le petit rond qui tourne (« En rédaction ») ou une coche verte (« Prêt ») */
  #app :is(#prepTabs,#sdTabs) .cvp-etat{font-size:0;padding:0;background:none;gap:0}
  #app :is(#prepTabs,#sdTabs) .cvp-etat.ok::before{content:"✓";font-size:13px;font-weight:700;color:var(--ok)}
  html[data-theme="clair"] #app :is(#prepTabs,#sdTabs){background:rgba(17,26,43,.06)}
  html[data-theme="clair"] #app :is(#prepTabs,#sdTabs) button.on{background:#fff;box-shadow:0 1px 3px rgba(17,26,43,.14)}

  /* candidature envoyée : le statut (« Envoyée »…) passe sous le titre au lieu de déborder à droite,
     et « Télécharger les deux documents » prend toute la largeur, centré */
  #app .am:has(#sdTabs) .ahead{flex-direction:column;align-items:flex-start;gap:10px;padding-bottom:16px}   /* le statut ne touche plus la ligne du dessous */
  #app .am:has(#sdTabs) .prep-foot{flex-direction:column;align-items:stretch;gap:10px;text-align:center}
  #app .am:has(#sdTabs) .prep-foot .mini{margin-left:0 !important;width:100%;height:46px;justify-content:center}

  /* barre fixe en bas à la place de la barre d'onglets : « CV adapté », « Lettre », « ••• » */
  #app.am-prep #mtabs{display:none}
  #prepBar{display:grid;grid-template-columns:1fr 1fr 48px;gap:8px;flex:0 0 auto;position:relative;z-index:5;
    padding:10px 16px calc(10px + env(safe-area-inset-bottom));background:rgba(10,15,26,.97);border-top:1px solid var(--line)}
  #prepBar button{height:46px;border-radius:13px;font:600 14.5px var(--fb);display:flex;align-items:center;justify-content:center;gap:7px;cursor:pointer;-webkit-tap-highlight-color:transparent}
  #prepBar button svg{width:17px;height:17px;flex:0 0 auto}
  #prepBar .pb-b{border:0;background:var(--grad-cta);color:var(--light-ink)}
  #prepBar .pb-b.ok{background:var(--ok-tint);color:var(--ok);border:1px solid var(--ok)}
  #prepBar .pb-plus{border:1px solid var(--line);background:none;color:var(--ink);font-size:13px;letter-spacing:1px}
  #prepBar button:disabled{opacity:.45;cursor:default}
  html[data-theme="clair"] #prepBar{background:#F7FAFE}
  html[data-theme="clair"] #prepBar .pb-b:not(.ok){color:#fff}   /* bleu marine en mode clair : texte blanc */
}
/* fenêtre « Télécharger » : une ligne par choix */
#pchoix .pc-l{display:flex;flex-direction:column;align-items:flex-start;gap:2px;width:100%;padding:13px 2px;border:0;border-bottom:1px solid var(--line);
  background:none;text-align:left;cursor:pointer;-webkit-tap-highlight-color:transparent}
#pchoix .pc-l b{font:600 15.5px var(--fb);color:var(--ink)}
#pchoix .pc-l span{font-size:12.5px;color:var(--muted)}
#pchoix .pc-l:last-of-type{border-bottom:0}
#pchoix .pc-l:disabled{opacity:.45;cursor:default}
#pchoix .pc-pied{height:calc(12px + env(safe-area-inset-bottom))}

/* pastille du nombre sur « Candidatures » (barre du bas) : en mode clair le fond est bleu foncé, le chiffre en blanc */
html[data-theme="clair"] #mtabs .bdg{color:#fff}

/* fiche d'une offre (téléphone) : poignée en haut (on la referme en glissant vers le bas) et bouton du bas
   sur toute la largeur */
@media(max-width:600px){
  #sheet .sheet-card{position:relative}
  #sheet .sheet-card::before{content:"";position:absolute;top:7px;left:50%;transform:translateX(-50%);width:38px;height:5px;border-radius:3px;background:var(--muted-2);opacity:.5;z-index:2}
  #sheet .sheet-f{padding-bottom:calc(14px + env(safe-area-inset-bottom))}
  #sheet .sheet-f > .mini.am-postuler{margin-left:0 !important;flex:1 1 100%;height:50px;border-radius:14px;font-size:15.5px;justify-content:center}
  html[data-theme="clair"] #sheet .sheet-f > .mini.am-postuler{color:#fff}
}

/* candidature envoyée (téléphone) : chaque information une seule fois (voir appli-mobile.js) */
@media(max-width:600px){
  #app .am:has(#sdTabs) .sd-tete{display:flex;align-items:center;gap:12px;min-width:0;width:100%}
  #app .am:has(#sdTabs) .sd-tete .mono{width:46px;height:46px;flex:0 0 auto;border-radius:13px;background:var(--cobalt-tint);border:1px solid var(--line);display:flex;align-items:center;justify-content:center;font-family:var(--fd);font-weight:500;font-size:19px;color:var(--cobalt-ink);overflow:hidden}
  #app .am:has(#sdTabs) .sd-tete .mono.has-logo{background:#fff}
  #app .am:has(#sdTabs) .sd-tete .mono img{width:100%;height:100%;object-fit:contain;padding:4px}
  #app .am:has(#sdTabs) .sd-tete .mono.has-logo span{display:none}
  #app .am:has(#sdTabs) .sd-statut{display:flex;align-items:center;gap:8px;width:100%;padding:9px 12px;border-radius:12px;
    background:var(--ok-tint);color:var(--ok);font:600 13.5px var(--fb)}
  #app .am:has(#sdTabs) .sd-statut svg{width:16px;height:16px;flex:0 0 auto}
  #app .am:has(#sdTabs) .ahead > .sd-statut{flex-direction:row;align-items:center !important;gap:8px !important}   /* coche à côté du texte (la règle de l'en-tête la mettait au-dessus) */
  #app .am:has(#sdTabs) .prep-side,#app .am:has(#sdTabs) .sd-offre .sd-head{display:none}
}
