:root {
    --vert: #1d4d3a;
    --vert-clair: #e7f2ec;
    --texte: #1f2937;
    --texte-clair: #6b7280;
    --fond: #f7f7f5;
    --carte: #ffffff;
    --bordure: #e2e2df;
    --alerte: #b45309;
    --alerte-fond: #fef3c7;
    --danger: #b91c1c;
    --rayon: 10px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    background: var(--fond);
    color: var(--texte);
    padding-bottom: 2rem;
    /* Garde-fou : un dépassement horizontal (même mineur) casse le
       position:sticky sur Chrome Android — cf. incident du 13/09/2026. */
    overflow-x: hidden;
}

a { color: var(--vert); }

.entete {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--vert);
    color: white;
    padding: 0.9rem 1rem;
    position: sticky;
    top: 0;
    z-index: 30;
    height: 56px;
}
.entete .logo { color: white; text-decoration: none; font-weight: 700; font-size: 1.2rem; }
.btn-menu { background: none; border: none; color: white; font-size: 1.4rem; cursor: pointer; }

.menu {
    display: none;
    flex-direction: column;
    background: white;
    border-bottom: 1px solid var(--bordure);
    position: sticky;
    top: 56px;
    z-index: 20;
}
.menu.ouvert { display: flex; }
.menu a {
    padding: 0.9rem 1.2rem;
    text-decoration: none;
    color: var(--texte);
    border-bottom: 1px solid var(--bordure);
}
.menu a.actif { color: var(--vert); font-weight: 600; }
.menu a.deconnexion { color: var(--danger); }

@media (min-width: 720px) {
    .menu {
        display: flex;
        flex-direction: row;
        justify-content: center;
        align-items: center;
        gap: 0.5rem;
        height: 48px;
    }
    .menu a { border-bottom: none; }
    .btn-menu { display: none; }
}

.contenu {
    max-width: 720px;
    margin: 0 auto;
    padding: 1rem;
}

.page-login { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-box {
    background: var(--carte);
    padding: 2rem;
    border-radius: var(--rayon);
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
    width: min(90vw, 340px);
    text-align: center;
}
.login-box h1 { margin: 0; color: var(--vert); }
.login-box .sous-titre { color: var(--texte-clair); margin-top: 0.2rem; }
.login-box form { display: flex; flex-direction: column; gap: 0.8rem; margin-top: 1.2rem; }
.login-box input { padding: 0.7rem; border: 1px solid var(--bordure); border-radius: var(--rayon); font-size: 1rem; }
.login-box .erreur { color: var(--danger); }

button, .bouton-principal, .bouton-nav, .bouton-danger {
    font-family: inherit;
    font-size: 0.95rem;
    cursor: pointer;
}

.bouton-principal, button[type="submit"] {
    background: var(--vert);
    color: white;
    border: none;
    padding: 0.75rem 1.2rem;
    border-radius: var(--rayon);
}

.bouton-danger, .lien-danger {
    background: none;
    color: var(--danger);
    border: 1px solid var(--danger);
    padding: 0.5rem 0.9rem;
    border-radius: var(--rayon);
}
.lien-danger { border: none; padding: 0; text-decoration: underline; font-size: 0.85rem; }

.barre-semaine {
    display: flex;
    align-items: center;
    justify-content: space-between;
    /* Compense le padding-top de .contenu pour que la barre soit déjà
       "compressée" (collée au menu) tout en haut de page, sans ce petit
       espace vide au-dessus visible avant le premier scroll (13/09/2026). */
    margin-top: -1rem;
    margin-bottom: 1rem;
    gap: 0.5rem;
    position: sticky;
    top: 56px;
    z-index: 10;
    background: var(--fond);
    padding: 0.6rem 0;
    border-bottom: 1px solid var(--bordure);
}

@media (min-width: 720px) {
    .barre-semaine { top: 104px; }
}
.bouton-nav {
    text-decoration: none;
    background: var(--carte);
    border: 1px solid var(--bordure);
    padding: 0.5rem 0.8rem;
    border-radius: var(--rayon);
    color: var(--texte);
    white-space: nowrap;
}
.bouton-nav-icone {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 999px;
    background: var(--carte);
    border: 1px solid var(--bordure);
    color: var(--vert);
    text-decoration: none;
}
.bouton-nav-icone:active { background: var(--vert-clair); }
.libelle-semaine {
    flex: 1;
    text-align: center;
    display: flex;
    flex-direction: column;
    line-height: 1.3;
    min-width: 0;
}
.numero-semaine { font-weight: 700; }
.plage-semaine { font-size: 0.85rem; color: var(--texte-clair); }

.message-succes {
    background: var(--vert-clair);
    color: var(--vert);
    padding: 0.6rem 0.9rem;
    border-radius: var(--rayon);
    margin-bottom: 1rem;
}

.message-alerte {
    background: var(--alerte-fond);
    color: var(--alerte);
    padding: 0.6rem 0.9rem;
    border-radius: var(--rayon);
    margin-bottom: 1rem;
    font-size: 0.9rem;
}
.message-alerte a { color: var(--alerte); font-weight: 600; }

.carte-jour {
    background: var(--carte);
    border: 1px solid var(--bordure);
    border-radius: var(--rayon);
    padding: 0.9rem;
    margin-bottom: 0.8rem;
}
.carte-jour.jour-ferie { border-color: var(--alerte); }
.carte-jour.jour-dimanche { background: #fbfbf7; }
.carte-jour-entete { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.6rem; gap: 0.5rem; }
.carte-jour-entete-gauche { display: flex; align-items: center; gap: 0.5rem; min-width: 0; }
.carte-jour-champs { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; }
.carte-jour-champs label { display: flex; flex-direction: column; font-size: 0.8rem; color: var(--texte-clair); gap: 0.25rem; min-width: 0; }
.carte-jour-champs input[type="text"], .carte-jour-champs input[type="time"], .carte-jour-champs select {
    padding: 0.55rem; border: 1px solid var(--bordure); border-radius: 8px; font-size: 0.95rem; background: white;
    width: 100%; min-width: 0; box-sizing: border-box;
}
.case-permanence { flex-direction: row !important; align-items: center; gap: 0.4rem !important; flex-shrink: 0; font-size: 0.85rem !important; white-space: nowrap; }
.champ-collegue, .champ-vehicule { grid-column: span 2; }

.carte-jour-resultat { margin-top: 0.7rem; padding-top: 0.6rem; border-top: 1px dashed var(--bordure); font-size: 0.88rem; display: flex; flex-direction: column; gap: 0.3rem; }
.annotations { display: flex; flex-wrap: wrap; gap: 0.3rem; margin-top: 0.3rem; }

.badge {
    display: inline-block;
    background: var(--vert-clair);
    color: var(--vert);
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    font-size: 0.75rem;
}
.badge-ferie { background: var(--alerte-fond); color: var(--alerte); }
.badge-indemnite { background: #e0edff; color: #1d4ed8; }
.badge-alerte { background: var(--alerte-fond); color: var(--alerte); }

.totaux-semaine {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    background: var(--carte);
    border: 1px solid var(--bordure);
    border-radius: var(--rayon);
    padding: 0.8rem;
    margin-bottom: 1rem;
    font-size: 0.95rem;
}
@media (min-width: 720px) {
    .totaux-semaine { flex-direction: row; justify-content: space-around; gap: 0; }
}

.actions-semaine { margin-bottom: 1.5rem; }
.actions-semaine button { width: 100%; padding: 0.9rem; font-size: 1rem; }
.form-effacer { text-align: center; }

.table-bulletin, .table-historique, .table-semaines {
    width: 100%;
    table-layout: fixed;
    border-collapse: collapse;
    background: var(--carte);
    border: 1px solid var(--bordure);
    border-radius: var(--rayon);
    overflow: hidden;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}
.table-bulletin td, .table-historique td, .table-historique th, .table-semaines td, .table-semaines th {
    padding: 0.55rem 0.8rem;
    border-bottom: 1px solid var(--bordure);
    overflow-wrap: break-word;
}
.table-bulletin .valeur, .table-semaines td:not(:first-child) { text-align: right; }
.table-bulletin td.valeur { width: 38%; }
/* Colonnes resserrées pour que les 4 colonnes de chiffres tiennent sur une
   seule ligne, y compris leurs en-têtes, sur petit écran (13/09/2026). */
.table-semaines th:first-child, .table-semaines td:first-child { width: 26%; }
.table-semaines th:not(:first-child), .table-semaines td:not(:first-child) { width: 18.5%; }
.table-semaines td, .table-semaines th { padding: 0.5rem 0.3rem; font-size: 0.82rem; }
.table-bulletin tr.section td { background: var(--vert-clair); font-weight: 600; color: var(--vert); }
.table-bulletin tr.total td { font-weight: 700; border-top: 2px solid var(--vert); }
.table-bulletin tr.sous-info td { color: var(--texte-clair); font-size: 0.85rem; }
.note-estimation { color: var(--texte-clair); font-size: 0.85rem; }

.bloc { margin-bottom: 2rem; }
.bloc h2 { color: var(--vert); font-size: 1.1rem; border-bottom: 2px solid var(--vert-clair); padding-bottom: 0.4rem; }
.aide { color: var(--texte-clair); font-size: 0.85rem; }

.parametre {
    background: var(--carte);
    border: 1px solid var(--bordure);
    border-radius: var(--rayon);
    padding: 0.6rem 0.9rem;
    margin-bottom: 0.5rem;
}
.parametre summary {
    display: flex;
    justify-content: space-between;
    cursor: pointer;
    list-style: none;
}
.parametre summary::-webkit-details-marker { display: none; }

.form-inline {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    align-items: flex-end;
    margin: 0.7rem 0;
}
.form-inline label { display: flex; flex-direction: column; font-size: 0.8rem; color: var(--texte-clair); gap: 0.25rem; }
.form-inline input, .form-inline select { padding: 0.5rem; border: 1px solid var(--bordure); border-radius: 8px; }
.form-inline button { padding: 0.55rem 1rem; }

.champ-court { width: 4.5rem; padding: 0.4rem; border: 1px solid var(--bordure); border-radius: 8px; }

details.detail-semaines { margin-top: 1rem; }
