body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    background-attachment: fixed;
    color: #333;
    margin: 0;
    padding: 0;
    line-height: 1.6;
    width: 100%;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

* { box-sizing: border-box; }

header {
    background: linear-gradient(to right, #002664, #FECB00, #C8102E);
    color: white;
    padding: 30px 20px;
    text-align: center;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

header h1 {
    margin: 0;
    font-size: 2.5em;
}

nav {
    background: #333;
    padding: 15px;
    text-align: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

nav a,
nav button {
    display: inline-block;
    color: white;
    margin: 0 20px;
    padding: 0;
    border: 0;
    background: none;
    font: inherit;
    text-decoration: none;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.3s;
}

nav a:hover,
nav a.active {
    color: #FECB00;
}

.icone-compte {
    width: 18px;
    height: 18px;
    margin-right: 6px;
    vertical-align: -3px;
    fill: currentColor;
}

.pill {
    margin-left: 4px;
    padding: 0 8px;
    border-radius: 99px;
    background: #FECB00;
    color: #222;
    font-size: .8em;
}

.container {
    flex: 1;
    width: 100%;
    max-width: 1400px;
    margin: 20px auto;
    padding: 20px;
}

.page-title {
    margin: 0;
    color: #002664;
}

.lead {
    margin: 0 0 20px;
    color: #555;
}

.card,
.course {
    display: block;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    padding: 25px;
    position: relative;
    color: inherit;
    transition: box-shadow 0.3s;
}

.course:hover {
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.2);
    background-color: #fcfcfc;
}

.card-narrow {
    max-width: 520px;
    margin: 0 auto;
}

.card h2,
.course h3 {
    margin-top: 0;
    color: #002664;
}

.course-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 350px), 1fr));
    gap: 25px;
    width: 100%;
}

.course h3 {
    margin-bottom: 6px;
    overflow-wrap: anywhere;
}

.empty {
    text-align: center;
    color: #555;
}

.search {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin: 20px 0 30px;
}

#search {
    flex: 1 1 320px;
    max-width: 640px;
    box-sizing: border-box;
    padding: 16px 22px 16px 54px;
    border: 2px solid transparent;
    border-radius: 999px;
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23002664' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='10' cy='10' r='7'/%3E%3Cpath d='M21 21l-6-6'/%3E%3C/svg%3E") no-repeat 20px center / 22px 22px;
    box-shadow: 0 6px 20px rgba(0, 38, 100, 0.12);
    color: #1f2633;
    font-size: 17px;
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
}

#search::placeholder { color: #8a93a6; }
#search:hover { box-shadow: 0 8px 24px rgba(0, 38, 100, 0.18); }

#search:focus {
    border-color: #002664;
    outline: none;
    box-shadow: 0 0 0 4px rgba(254, 203, 0, 0.5), 0 6px 20px rgba(0, 38, 100, 0.15);
}

.search .btn { border-radius: 999px; padding: 0 28px; }

label {
    display: block;
    margin: 16px 0 6px;
    color: #002664;
    font-weight: bold;
}

.optional { color: #777; font-weight: normal; }

label.case {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 18px;
    color: #333;
    font-weight: normal;
    cursor: pointer;
}

label.case input { width: 18px; height: 18px; margin: 0; accent-color: #002664; }

input[type=text],
input[type=email],
input[type=password],
select,
textarea {
    width: 100%;
    padding: 12px 14px;
    border: 2px solid #ccc;
    border-radius: 8px;
    background: white;
    color: #333;
    font: inherit;
    transition: border-color 0.3s;
}

input:focus,
select:focus,
textarea:focus {
    border-color: #002664;
    outline: none;
}

textarea { min-height: 100px; resize: vertical; }

input[type=file] {
    width: 100%;
    padding: 12px;
    border: 2px dashed #ccc;
    border-radius: 8px;
    background: #fafbfd;
    font: inherit;
}

.hint { margin: 4px 0 0; color: #777; font-size: .9em; }
.switch { margin: 20px 0 0; text-align: center; }
.switch a, .notice a { color: #002664; font-weight: bold; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.btn {
    display: inline-block;
    padding: 10px 20px;
    border: 2px solid #002664;
    border-radius: 8px;
    background: #002664;
    color: white;
    font: inherit;
    font-weight: bold;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition: color 0.3s, background 0.3s, border-color 0.3s;
}

.btn:hover { background: #333; border-color: #333; color: #FECB00; }
.btn-ghost { background: white; color: #002664; }
.btn-ghost:hover { background: #333; border-color: #333; color: #FECB00; }
.btn-green { background: #2e7d32; border-color: #2e7d32; }
.btn-red { background: #c62828; border-color: #c62828; }
.btn-danger { background: white; color: #c62828; border-color: #c62828; }
.btn-block { display: block; width: 100%; margin-top: 24px; }
.btn-small { padding: 6px 14px; font-size: .92em; }

.flash { margin-bottom: 20px; padding: 14px 18px; border-radius: 8px; font-weight: 600; }
.flash-succes { background: #e3f4e5; color: #1b5e20; }
.flash-erreur { background: #fdecea; color: #b71c1c; }
.flash-info { background: #e8eefb; color: #002664; }
.errors { margin: 0; padding-left: 18px; }

.notice {
    margin-bottom: 25px;
    padding: 14px 18px;
    border-left: 5px solid #FECB00;
    border-radius: 8px;
    background: white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.meta { margin: 0; color: #666; font-size: .9em; overflow-wrap: anywhere; }
.desc { margin: 10px 0 0; overflow-wrap: anywhere; }

.badge {
    display: inline-block;
    margin: 0 6px 6px 0;
    padding: 2px 12px;
    border-radius: 99px;
    background: #002664;
    color: #FECB00;
    font-size: .82em;
    font-weight: bold;
}

.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.barre-biblio { margin: -14px 0 25px; }
.actions form { margin: 0; }

.status { display: inline-block; margin-top: 10px; padding: 2px 12px; border-radius: 99px; font-size: .85em; font-weight: bold; }
.status-en_attente { background: #fff4c2; color: #7a5600; }
.status-accepte { background: #e3f4e5; color: #1b5e20; }
.status-refuse { background: #fdecea; color: #b71c1c; }

.refuse-form { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.refuse-form input { flex: 1; min-width: 160px; padding: 8px 12px; }

.tabs, .pagination { display: flex; flex-wrap: wrap; gap: 10px; margin: 0 0 25px; }
.pagination { justify-content: center; margin-top: 30px; }

.tab {
    padding: 8px 18px;
    border-radius: 99px;
    background: white;
    color: #002664;
    font-weight: bold;
    text-decoration: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.tab.active, .tab:hover { background: #333; color: #FECB00; }

.profil { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }

.avatar {
    flex: none;
    display: block;
    width: 96px;
    height: 96px;
    border: 3px solid white;
    border-radius: 50%;
    background: #c9d3e6;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    overflow: hidden;
}

.avatar svg { display: block; width: 100%; height: 100%; fill: white; }
.avatar img,
.mini-avatar img { display: block; width: 100%; height: 100%; object-fit: cover; }

.mini-avatar {
    display: inline-block;
    width: 22px;
    height: 22px;
    margin-right: 4px;
    border-radius: 50%;
    background: #c9d3e6;
    vertical-align: -6px;
    overflow: hidden;
}

.mini-avatar svg { display: block; width: 100%; height: 100%; fill: white; }

.carte-compte { max-width: 760px; }

.avatar-menu { position: relative; flex: none; }
.avatar-menu > summary { display: block; position: relative; border-radius: 50%; cursor: pointer; list-style: none; }
.avatar-menu > summary::-webkit-details-marker { display: none; }
.avatar-menu > summary:hover .avatar { filter: brightness(0.9); }

.avatar-badge {
    position: absolute;
    right: 0;
    bottom: 2px;
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border: 2px solid white;
    border-radius: 50%;
    background: #002664;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}

.avatar-badge svg { width: 16px; height: 16px; fill: white; }

.menu-photo {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    z-index: 50;
    min-width: 230px;
    padding: 6px;
    border-radius: 10px;
    background: white;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.2);
}

.menu-photo form { margin: 0; }

.menu-photo label,
.menu-photo button {
    display: block;
    width: 100%;
    margin: 0;
    padding: 11px 14px;
    border: 0;
    border-radius: 8px;
    background: none;
    color: #333;
    font: inherit;
    font-weight: bold;
    text-align: left;
    cursor: pointer;
}

.menu-photo label:hover,
.menu-photo button:hover { background: #f0f2f5; }
.menu-photo .danger { color: #c62828; }

input[type=file].fichier-cache {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    border: 0;
    opacity: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    pointer-events: none;
}

.bas-compte {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid #e6e8ee;
}

.bas-compte form { margin: 0; }

.bas-compte a,
.bas-compte button {
    padding: 0;
    border: 0;
    background: none;
    color: #002664;
    font: inherit;
    font-weight: bold;
    text-decoration: none;
    cursor: pointer;
}

.bas-compte button { color: #c62828; }
.bas-compte a:hover, .bas-compte button:hover { text-decoration: underline; }

[data-pret] { outline: 3px solid #FECB00; }

.carte-message .profil { flex-wrap: nowrap; margin-bottom: 6px; }
.carte-message .profil > div { flex: 1; min-width: 0; }
.avatar-petit { width: 64px; height: 64px; }
.message-texte { margin-top: 0; font-size: 1.05em; }
.message-termine { opacity: 0.7; }

.profil h2 { margin: 0; color: #002664; overflow-wrap: anywhere; }
.compteurs { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 20px; }

.compteur {
    flex: 1;
    min-width: 120px;
    padding: 14px;
    border-radius: 10px;
    background: #f5f7fa;
    text-align: center;
}

.compteur strong { display: block; color: #002664; font-size: 1.6em; line-height: 1.2; }
.grille-compte { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: 25px; margin-top: 25px; }
.section-title { margin: 40px 0 20px; color: #002664; }

footer {
    background: #333;
    color: white;
    text-align: center;
    padding: 15px;
    margin-top: 40px;
}

#sanda {
    position: static;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: #FECB00;
    line-height: 15px;
}

#sandabs {
    color: #f9f9f9;
    height: fit-content;
    line-height: 15px;
}

@media (max-width: 600px) {
    header h1 { font-size: 1.8em; }
    nav a, nav button { margin: 4px 12px; }
    .container { padding: 16px; }
    .card, .course { padding: 20px; }
    #search { flex-basis: 100%; padding: 14px 18px 14px 48px; background-position: 16px center; background-size: 20px 20px; font-size: 16px; }
    .search .btn { width: 100%; padding: 12px; }
}

.lecteur-entete { max-width: 900px; margin: 0 auto 18px; }
.lecteur-entete .page-title { margin: 10px 0 14px; overflow-wrap: anywhere; }
.lecteur-retour { color: #002664; font-weight: bold; text-decoration: none; }
.lecteur-retour:hover { text-decoration: underline; }
.lecteur-cadenas { margin: 0; }
.notice a.btn { color: white; }
.notice a.btn-ghost { color: #002664; }
.notice a.btn:hover { color: #FECB00; }
.lecteur-cadenas .actions { margin-top: 12px; }
.lecteur { max-width: 900px; margin: 0 auto; }
.lecteur-etat { padding: 40px 0; text-align: center; color: #555; }

.page-pdf {
    width: 100%;
    margin: 0 auto 14px;
    background: white;
    border-radius: 6px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
    overflow: hidden;
}

.page-pdf canvas { display: block; width: 100%; height: auto; }

.lecteur-compteur {
    position: fixed;
    right: 14px;
    bottom: 14px;
    z-index: 50;
    padding: 6px 14px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.72);
    color: white;
    font-size: 14px;
    font-weight: bold;
}

.lecteur-compteur:empty { display: none; }

.carte-contact { max-width: 600px; }
.contact-merci { text-align: center; }
.contact-icone { font-size: 52px; line-height: 1; }

.boite-entete { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 16px; }
.boite-entete .lead { margin: 0; }
.boite { display: flex; flex-direction: column; gap: 14px; }
.message-recu.non-lu { border-left: 5px solid #FECB00; }
.message-tete { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 4px; }
.message-tete .badge { margin: 0; }
.message-objet { margin: 8px 0 0; color: #002664; font-weight: bold; font-size: 1.05em; overflow-wrap: anywhere; }
.ma-reponse { margin-top: 12px; padding: 10px 14px; border-left: 4px solid #002664; border-radius: 0 8px 8px 0; background: #f2f5fb; }
.ma-reponse .desc { margin-top: 4px; }
.form-reponse { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; margin-top: 14px; }
.form-reponse textarea { min-height: 70px; }
.pas-de-compte { margin-top: 12px; font-style: italic; }
.notif.non-lu { border-left: 5px solid #FECB00; }
.ton-message { margin-top: 12px; padding: 10px 14px; border-left: 4px solid #c9d3e6; border-radius: 0 8px 8px 0; background: #f6f7fa; }
.ton-message .desc { margin-top: 4px; color: #555; }
.modifier-pseudo { margin: 2px 0 6px; }
.modifier-pseudo summary { display: inline-block; color: #002664; font-size: 0.9em; font-weight: bold; list-style: none; cursor: pointer; }
.modifier-pseudo summary::-webkit-details-marker { display: none; }
.modifier-pseudo summary:hover { text-decoration: underline; }
.form-pseudo { display: flex; flex-direction: column; align-items: stretch; gap: 4px; max-width: 360px; margin-top: 8px; }
.form-pseudo label { margin: 6px 0 2px; font-size: 0.9em; }
.form-pseudo input[type=text] { width: 100%; padding: 8px 12px; }
.form-pseudo .btn { align-self: flex-start; margin-top: 8px; }
.arobase { margin: 0 0 4px; color: #5f6b7a; font-weight: bold; }
.arobase-mini { color: #5f6b7a; font-weight: normal; }
.champ-arobase { display: flex; align-items: center; border: 2px solid #ccc; border-radius: 8px; background: white; overflow: hidden; transition: border-color 0.3s; }
.champ-arobase:focus-within { border-color: #002664; }
.champ-arobase span { padding: 0 2px 0 14px; color: #002664; font-size: 1.05em; font-weight: bold; }
.champ-arobase input[type=text] { flex: 1; min-width: 0; border: 0; padding-left: 2px; }
.compteurs-membres { margin: 0 0 20px; }
.filtre-membres { display: block; width: 100%; max-width: 520px; margin: 0 0 18px; }
.liste-membres { display: flex; flex-direction: column; overflow: hidden; border-radius: 12px; background: white; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1); }
.membre { display: flex; align-items: center; gap: 14px; padding: 14px 18px; border-bottom: 1px solid #eceff4; }
.membre:last-child { border-bottom: 0; }
.membre[hidden] { display: none; }
.avatar-membre { width: 52px; height: 52px; border-width: 2px; box-shadow: none; }
.membre-infos { flex: 1; min-width: 0; }
.membre-nom { margin: 0; overflow-wrap: anywhere; }
.membre-nom .badge { margin: 0 0 0 6px; }
.membre-infos .meta { margin: 2px 0 0; }
.membre-acces { flex: none; display: flex; align-items: center; gap: 8px; text-align: right; font-size: 0.92em; }
.membre-acces strong { display: block; color: #1f2633; }
.membre-acces small { display: block; color: #777; }
.point-acces { flex: none; width: 10px; height: 10px; border-radius: 50%; background: #c4c9d4; }
.point-acces.recent { background: #FECB00; }
.point-acces.en-ligne { background: #2e7d32; box-shadow: 0 0 0 3px rgba(46, 125, 50, 0.2); }

@media (max-width: 600px) {
    .membre { flex-wrap: wrap; padding: 12px 14px; }
    .avatar-membre { width: 44px; height: 44px; }
    .membre-acces { width: 100%; justify-content: flex-start; padding-left: 58px; text-align: left; }
}
