:root { color-scheme: light; }
body:has(.pilot-page) {
  margin: 0;
  background: #eff4fa;
  color: #17283c;
  font: 16px/1.55 system-ui, sans-serif;
}
.pilot-page { width: min(100% - 32px, 760px); margin: 32px auto; }
.pilot-page h1, #pilot-tools h2 { line-height: 1.2; }
.pilot-page section, #pilot-tools {
  box-sizing: border-box;
  padding: clamp(16px, 4vw, 28px);
  border: 1px solid #d1dce9;
  border-radius: 16px;
  background: #fff;
  color: #17283c;
  overflow-wrap: anywhere;
}
.pilot-page section + section { margin-top: 16px; }
.pilot-page form, #pilot-tools form { display: grid; gap: 12px; }
.pilot-page label, #pilot-tools label { display: grid; gap: 4px; }
.pilot-page label[hidden] { display: none; }
.pilot-page :is(input,select,button), #pilot-tools :is(select,button,input,textarea), #pilot-account button {
  box-sizing: border-box;
  min-height: 44px;
  max-width: 100%;
  padding: 8px 12px;
  border: 1px solid #7489a1;
  border-radius: 8px;
  font: inherit;
}
.pilot-page button, #pilot-tools button, #pilot-account button {
  width: fit-content;
  background: #183e66;
  color: #fff;
  cursor: pointer;
}
.pilot-page button:disabled, #pilot-tools button:disabled { opacity:.55; cursor:wait; }
.pilot-page :focus-visible, #pilot-tools :focus-visible, #pilot-account :focus-visible { outline: 3px solid #0f6bad; outline-offset: 2px; }
.pilot-page ul, #pilot-tools ul { padding-inline-start: 18px; }
.pilot-page li, #pilot-tools li { margin-block: 12px; }
.pilot-page p.recap { white-space: pre-wrap; }
.pilot-row, #pilot-account { display:flex; flex-wrap:wrap; gap:8px; align-items:center; }
#pilot-tools { width:min(100% - 24px,720px); max-width:none; max-height:calc(100dvh - 24px); overflow:auto; }
#pilot-account { margin:8px 16px; }
html[data-pilot-locked] :is(#app-shell,#public-page,.skip-link,dialog) { display:none!important; }

html[data-pilot-build] [data-nav="eleves"],
html[data-pilot-build] [data-nav="organisateur"],
html[data-pilot-build] [data-action="edit-payment-link"],
html[data-pilot-build] [data-action="new-payment-link"],
html[data-pilot-build] #organizer-shortcut,
/* Professeur seul (23/11/2026) : Bookings et Finances ouverts ; seule la rubrique DJ reste masquée. */
html[data-pilot-profile="teacher"] [data-nav="dj"],
/* DJ alone (17/11/2026): no private courses, no course library (Bibliothèque, Vidéos) and no pupil invoice by e-mail. */
html[data-pilot-profile="dj"] :is([data-nav="private"],[data-action="new-private"],[data-nav="cours"],[data-videos-entry],[data-action="new-student-invoice"]) { display:none!important; }
.pilot-steps { padding-inline-start:20px; line-height:1.5; }
.pilot-tutorial { margin-block:12px; }
.pilot-tutorial > summary { cursor:pointer; font-weight:600; min-height:44px; display:flex; align-items:center; }
.pilot-note { padding:10px 12px; border-left:4px solid #254DB1; background:#eef3fd; }

/* Lot Drive, étape A : écran « Connecte ton Google Drive » et ligne d'état. */
#pilot-drive-prompt {
  box-sizing: border-box;
  width: min(100% - 32px, 560px);
  max-height: calc(100dvh - 32px);
  overflow: auto;
  padding: clamp(16px, 4vw, 28px);
  border: 1px solid #d1dce9;
  border-radius: 16px;
  background: #fff;
  color: #17283c;
  font: 16px/1.55 system-ui, sans-serif;
  overflow-wrap: anywhere;
}
#pilot-drive-prompt::backdrop { background: #101828b8; }
#pilot-drive-prompt h2 { margin: 0 0 8px; line-height: 1.2; }
#pilot-drive-prompt h2:focus { outline: none; }
.pilot-drive-points { padding-inline-start: 18px; }
.pilot-drive-points li { margin-block: 8px; }
.pilot-drive-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.pilot-drive-actions button {
  box-sizing: border-box; min-height: 44px; padding: 8px 16px; border: 1px solid #183e66;
  border-radius: 8px; background: #183e66; color: #fff; font: inherit; cursor: pointer;
}
.pilot-drive-actions .pilot-drive-later { background: #fff; color: #183e66; }
.pilot-drive-actions button:disabled { opacity: .55; cursor: wait; }
#pilot-drive-prompt :focus-visible { outline: 3px solid #0f6bad; outline-offset: 2px; }
.pilot-drive-small { font-size: 14px; color: #4a5d72; margin-bottom: 0; }
.pilot-drive-message { padding: 8px 12px; border-left: 4px solid #254DB1; background: #eef3fd; color: #17283c; margin: 8px 0 0; flex-basis: 100%; }
.pilot-drive-detail { color: inherit; opacity: .8; overflow-wrap: anywhere; }
[data-pilot-drive-row] { flex-wrap: wrap; }
/* iPhone : la fenêtre Drive reste centrée malgré les styles généraux des fenêtres du Cockpit. */
#pilot-drive-prompt[open] {
  position: fixed; inset: 0; margin: auto !important;
  width: min(100% - 32px, 560px) !important; max-width: 560px !important;
  height: fit-content; max-height: calc(100dvh - 32px);
}

.pilot-page form[hidden] { display:none; }
#pupil-manager[open] {
 box-sizing:border-box; position:fixed; inset:0; margin:auto;
 width:min(calc(100% - 24px),680px); max-height:calc(100dvh - 24px);
 padding:clamp(16px,4vw,28px); overflow:auto; overflow-wrap:anywhere;
 background:white; color:#17283c; border:1px solid #7489a1; border-radius:16px;
}
#pupil-manager::backdrop { background:#101828b8; }
#pupil-manager :is(input,select,textarea),.pilot-page textarea { box-sizing:border-box; width:100%; min-width:0; font:inherit; }
#pupil-manager form { margin-block:16px; }
#pupil-manager select,.pilot-page details summary { min-height:44px; }
#pupil-manager details[open],.pilot-page details[open] { padding-block:8px; }
/* Entrée de connexion unique (23/11/2026) — mêmes couleurs, polices et boutons que le Cockpit. */
body:has(.unified-login) { background:#f5f7fb; color:#293446; font:15px/1.5 -apple-system, system-ui, "Segoe UI", sans-serif; }
.pilot-page:has(.unified-login) { width:min(100% - 32px, 480px); }
.pilot-page section.unified-login { padding:0; overflow:hidden; border:1px solid #dbe2ee; border-radius:16px; box-shadow:0 10px 30px rgba(34,46,60,.08); }
.unified-login [hidden] { display:none; }
.unified-login-brand { display:flex; align-items:center; gap:12px; padding:20px 24px; background:#222e3c; color:#f6f8fc; }
.unified-login-mark { display:grid; place-items:center; flex:none; width:40px; height:40px; border:1px solid #8c9db8; border-radius:13px; font-size:25px; line-height:1; }
.unified-login-brand b, .unified-login-brand small { display:block; line-height:1.1; }
.unified-login-brand b { font-size:24px; letter-spacing:-1px; color:#fff; }
.unified-login-brand small { margin-top:3px; font-size:9px; letter-spacing:2px; color:#c7d2e5; }
.unified-login > :not(.unified-login-brand) { margin-inline:24px; }
.unified-login > :last-child { margin-bottom:24px; }
.unified-login h1 { margin-top:24px; margin-bottom:4px; font-family:"Avenir Next", -apple-system, system-ui, "Segoe UI", sans-serif; font-weight:650; font-size:clamp(28px, 7vw, 34px); letter-spacing:-.5px; color:#293446; }
.unified-login > p { color:#52607a; }
.unified-login label { font-weight:600; color:#293446; }
.unified-login input { border:1px solid #8795aa; border-radius:8px; font-weight:600; color:#293446; background:#fff; }
.unified-login button { border:1px solid #315fcd; border-radius:9px; background:#315fcd; color:#fff; font-weight:600; }
.unified-login button.unified-secondary { border-color:#8795aa; background:#fff; color:#293446; }
.unified-login .unified-login-or { margin:4px 24px; color:#6a768c; }
.unified-login [role=status]:empty { display:none; }
/* Rubriques verrouillées selon le profil (23/11/2026) : visibles, marquées Smart ou Pro. */
/* Grisées (texte et icône) ; la pastille dorée reste vive. */
[data-profile-locked] { color:#8b93a3 !important; background-image:none !important; cursor:default; }
[data-profile-locked] .ui-icon, [data-profile-locked] svg:not(.profile-lock-badge svg) { opacity:.45; filter:grayscale(1); }
.sidebar [data-profile-locked], .bottom-nav [data-profile-locked] { color:#7e899d !important; }
.profile-lock-badge { display:inline-block; white-space:nowrap; width:auto; text-align:center; flex:none; margin-inline-start:auto; padding:1px 8px; border:1px solid #b8891c; border-radius:999px; background:linear-gradient(180deg,#f8e08e,#dcae3a); color:#3f2c00 !important; font-size:.7rem; font-weight:700; line-height:1.5; letter-spacing:.02em; box-shadow:0 1px 2px rgba(120,85,0,.25); opacity:1; filter:none; }
.profile-lock-notice { position:fixed; z-index:1000; left:16px; right:16px; bottom:calc(92px + env(safe-area-inset-bottom)); display:grid; gap:4px; max-width:440px; margin-inline:auto; padding:12px 16px; border-radius:12px; background:#17283c; color:#fff; box-shadow:0 8px 24px rgba(23,40,60,.25); font:15px/1.45 system-ui,sans-serif; }
.profile-lock-notice[hidden] { display:none; }
@media (min-width: 900px) { .profile-lock-notice { bottom:24px; } }
/* Cours et récaps partagés dans le Cockpit Élève / Smart (23/11/2026). */
.pupil-courses { display:grid; gap:12px; margin-block:16px; }
.pupil-courses .card-head { display:flex; align-items:center; justify-content:space-between; gap:12px; }
.pupil-courses h2 { margin:0; }
.pupil-courses [role=status]:empty { display:none; }
.pupil-invites { display:grid; gap:8px; margin:0; padding:0; list-style:none; }
.pupil-invite { display:flex; flex-wrap:wrap; align-items:center; justify-content:space-between; gap:8px; padding:10px 12px; border:1px solid #c9d6f5; border-radius:12px; background:#eef3fd; }
.pupil-course, .pupil-note { display:grid; gap:6px; padding-top:12px; border-top:1px solid #e2e7f0; }
.pupil-course h3, .pupil-note h3 { margin:0; font-size:1rem; }
.pupil-course p, .pupil-note p { margin:0; }
.pupil-recap { white-space:pre-wrap; }
.pupil-course video { width:100%; max-height:70vh; border-radius:12px; background:#111; }
.pupil-notes-title { margin-top:8px !important; }
/* « Autres espaces » : cartes verrouillées grisées avec pastille dorée. */
.other-space-off[data-locked-by] { color:#8b93a3 !important; }
.other-space-off[data-locked-by] strong { color:#6f7889; overflow-wrap:normal; word-break:normal; }
.other-space-off[data-locked-by] .other-space-available { display:flex; align-items:center; gap:6px; margin-top:4px; white-space:nowrap; }
.other-space-off[data-locked-by] .other-space-available .profile-lock-badge { margin-inline-start:0; }
/* Pastilles (23/11/2026) : Smart en bleu métallique, Pro en doré lumineux. */
.profile-lock-badge[data-tier="smart"] { border-color:#5f7fa8; background:linear-gradient(180deg,#e9f1fb 0%,#b9cde6 38%,#7f9dc4 62%,#a9c0de 100%); color:#13263f !important; box-shadow:inset 0 1px 0 rgba(255,255,255,.7), 0 1px 2px rgba(30,55,90,.3); text-shadow:0 1px 0 rgba(255,255,255,.5); }
.profile-lock-badge[data-tier="pro"] { border-color:#d89a00; background:linear-gradient(180deg,#fff0a0 0%,#ffd23a 45%,#f2a900 100%); color:#3a2500 !important; box-shadow:0 0 0 1px rgba(255,214,64,.35), 0 0 8px rgba(255,190,20,.65); text-shadow:0 1px 0 rgba(255,255,255,.45); }
/* Vidéothèque Élève / Smart (23/11/2026) : sans les éléments réservés aux professionnels. */
html:is([data-cockpit-tier="eleve"],[data-cockpit-tier="smart"]) :is(#main-content .connection-hint, [data-detail-key="course-video-preparation"], [data-action="course-filter"][data-filter="own"], [data-action="course-filter"][data-filter="private"], #main-content [data-pipeline-action]) { display:none !important; }
.pupil-agenda { display:grid; gap:0; margin:0; padding:0; list-style:none; }
.pupil-agenda-row { display:grid; gap:2px; padding:10px 0; border-top:1px solid #e2e7f0; }
.pupil-agenda-date { font-size:.78rem; font-weight:600; letter-spacing:.02em; color:#315fcd; }
.pupil-agenda-link { justify-self:start; font-weight:600; }
/* Étiquette « Upgrade vers » + pastille, alignée à droite (23/11/2026). */
.profile-lock-tag { display:inline-flex; align-items:center; gap:6px; flex:none; margin-inline-start:auto; white-space:nowrap; }
.profile-lock-tag .profile-lock-badge { margin:0; }
.profile-lock-upgrade { font-size:.62rem; font-weight:600; letter-spacing:.02em; color:#7b8496; }
.side-nav .nav-item[data-profile-locked] { position:relative; padding-inline-end:78px !important; }
.side-nav .nav-item > .profile-lock-tag { position:absolute; right:10px; top:50%; transform:translateY(-50%); flex-direction:column; align-items:flex-end; gap:1px; }
.side-nav .profile-lock-upgrade { font-size:.55rem; color:#a9b4c8; }
.side-nav .profile-lock-badge { padding:0 6px; font-size:.6rem; }
.bottom-item[data-profile-locked] { position:relative; }
.bottom-item > .profile-lock-tag { position:absolute; top:2px; left:calc(50% + 8px); margin:0; }
.bottom-item:last-child > .profile-lock-tag { left:auto; right:2px; }
.bottom-nav .profile-lock-upgrade { display:none !important; }
.bottom-item .profile-lock-badge { padding:0 5px; font-size:.6rem; }
.space-link > .profile-lock-tag { display:flex; margin:8px 0 0; }
/* Séparateur de la barre de gauche. */
.profile-lock-divider { display:grid; justify-items:center; gap:5px; margin:12px 0 6px; }
.profile-lock-divider span { font-size:.62rem; font-weight:600; letter-spacing:.06em; color:#a9b4c8; }
.profile-lock-divider::after { content:''; width:50%; height:2px; border-radius:2px; background:rgba(201,213,232,.7); }
/* DJ : seulement avec le profil DJ (pilote). */
html[data-pilot-build]:not([data-dj-profile]) [data-nav="dj"] { display:none !important; }
/* Barre du bas (23/11/2026) : seulement les rubriques disponibles pour le profil ; une rubrique verrouillée n'y apparaît pas. */
.bottom-nav [data-profile-locked] { display:none !important; }
/* Boutons d'action dans les pages : pastille seule (pas de débordement sur mobile). */
#main-content [data-action] > .profile-lock-tag .profile-lock-upgrade { display:none !important; }
#main-content [data-action] > .profile-lock-tag { margin-inline-start:6px; }
/* Boutons de l'en-tête de page : pastille en coin, dans le bouton. */
#main-content .page-head .actions > [data-profile-locked] { position:relative; overflow:visible; }
#main-content .page-head .actions > [data-profile-locked] > .profile-lock-tag { position:absolute; top:-8px; right:-4px; margin:0; }
/* Mon espace élève (23/11/2026) : visible seulement quand la personne suit des cours chez un professeur. */
html:not([data-pupil-space]) [data-nav="monespace"] { display:none !important; }
/* Espace élève seul : uniquement Accueil, Agenda, Mon espace élève — aucune rubrique verrouillée affichée. */
html[data-cockpit-tier="eleve"] :is([data-profile-locked], .profile-lock-divider, #quick-add, [data-faithful-subscription], .other-spaces) { display:none !important; }
/* Mon espace élève : professeurs, offres (23/11/2026). */
#pupil-space-host { display:grid; gap:16px; }
#pupil-space-host [role=status]:empty { display:none; }
.pupil-teachers { display:grid; gap:0; margin:0; padding:0; list-style:none; }
.pupil-teacher { display:grid; gap:2px; padding:10px 0; border-top:1px solid #e2e7f0; }
.pupil-offers-link { display:block; width:calc(100% - 24px); margin:14px 12px 0; padding:10px 12px; border:1px solid rgba(201,213,232,.5); border-radius:10px; background:transparent; color:#f6f8fc; font:inherit; font-weight:600; text-align:left; cursor:pointer; }
.pupil-offers-card { display:flex; flex-wrap:wrap; align-items:center; justify-content:space-between; gap:10px; margin-block:12px; }
.pupil-offers-card > div { display:grid; gap:2px; }
dialog.pupil-offers { width:min(100% - 32px, 520px); border:0; border-radius:16px; padding:20px; }
dialog.pupil-offers article { display:grid; gap:6px; padding:12px 0; border-top:1px solid #e2e7f0; }
dialog.pupil-offers h3 { display:flex; align-items:center; justify-content:flex-start; gap:8px; margin:0; text-align:left; }
dialog.pupil-offers [role=status]:empty { display:none; }
/* Mes vidéos (R2) dans la Vidéothèque (23/11/2026). */
.account-videos { display:grid; gap:12px; margin-block:16px; }
.account-videos .card-head { display:flex; align-items:center; justify-content:space-between; gap:12px; }
.account-videos h2 { margin:0; }
.account-videos [role=status]:empty { display:none; }
.account-video-gauge { height:10px; border-radius:999px; background:#e6ebf3; overflow:hidden; }
.account-video-gauge span { display:block; height:100%; border-radius:999px; background:linear-gradient(90deg,#315fcd,#5f8be6); }
.account-video-usage { margin:0; }
.account-video-form { display:grid; gap:10px; }
.account-video-form label { display:grid; gap:4px; font-weight:600; }
.account-video-form progress { width:100%; }
.account-video { display:grid; gap:6px; padding-top:12px; border-top:1px solid #e2e7f0; }
.account-video-head { display:flex; justify-content:space-between; gap:8px; }
.account-video video { width:100%; max-height:60vh; border-radius:12px; background:#111; }
.account-video-delete { justify-self:start; }
/* Largeur bornée sur mobile (aucun débordement horizontal). */
:is(.account-videos, .account-video-form, .account-video, .pupil-courses, #pupil-space-host) { grid-template-columns:minmax(0,1fr); min-width:0; max-width:100%; }
:is(.account-videos, .account-video-form, .account-video, .pupil-courses) > *, .account-video-form label > input { min-width:0; max-width:100%; box-sizing:border-box; }
.account-video-form label > input { width:100%; }

/* Comptes (Cockpit unique), mobile : la barre du compte occupe déjà le haut ; on retire l'espace réservé
   au-dessus du Cockpit (76 px) et la place prise par la planche d'icônes, qui laissaient un grand vide (iPhone, 23/11/2026). */
@media (max-width:850px) {
  body:has(> #pilot-account) > svg.icon-definitions { position:absolute; width:0; height:0; overflow:hidden; }
  body.faithful-cockpit:has(> #pilot-account) .app-frame.shell { padding-top:8px; }
  #pilot-account { margin-top:calc(8px + env(safe-area-inset-top, 0px)); }
}
