/*
 * Feuille de style de l'interface de planification.
 * Écrite à la main, servie telle quelle : aucun build, aucune dépendance
 * externe. Mobile d'abord, thème clair et sombre selon le réglage du système.
 */

:root {
    color-scheme: light dark;

    --fond: #f6f5f3;
    --fond-carte: #ffffff;
    --fond-doux: #efedea;
    --texte: #1d1c1a;
    --texte-doux: #6b6862;
    --bordure: #e0ddd8;
    --accent: #7a5c2e;
    --accent-doux: #f0e6d6;
    --alerte: #a33224;
    --alerte-doux: #fbe9e6;
    --proche: #8a6212;
    --proche-doux: #fbf1dc;

    --rayon: 12px;
    --espace: 16px;
}

@media (prefers-color-scheme: dark) {
    :root {
        --fond: #16151a;
        --fond-carte: #201f26;
        --fond-doux: #2a2932;
        --texte: #ecebe8;
        --texte-doux: #a3a0a8;
        --bordure: #343340;
        --accent: #d9b57a;
        --accent-doux: #3a3223;
        --alerte: #f0938a;
        --alerte-doux: #3d2320;
        --proche: #e2bd72;
        --proche-doux: #3a2f1c;
    }
}

* {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    padding: 0;
    background: var(--fond);
    color: var(--texte);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 17px;
    line-height: 1.5;
    /* Marges de sécurité pour l'encoche et la barre d'accueil de l'iPhone. */
    padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

.enveloppe {
    max-width: 820px;
    margin: 0 auto;
    padding: var(--espace);
}

/* ---------------------------------------------------------------- En-tête */

.entete {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    padding: var(--espace) 0;
    border-bottom: 1px solid var(--bordure);
    margin-bottom: var(--espace);
}

.entete h1 {
    font-size: 1.35rem;
    margin: 0;
    letter-spacing: -0.01em;
}

.entete nav {
    display: flex;
    align-items: baseline;
    gap: 14px;
    font-size: 0.9rem;
}

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

a:hover {
    text-decoration: none;
}

.lien-retour {
    display: inline-block;
    margin-bottom: 12px;
    font-size: 0.9rem;
}

/* ------------------------------------------------------------------ Blocs */

section {
    margin-bottom: 28px;
}

h2 {
    font-size: 1.05rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--texte-doux);
    margin: 0 0 12px;
}

.carte {
    background: var(--fond-carte);
    border: 1px solid var(--bordure);
    border-radius: var(--rayon);
    padding: 14px 16px;
}

.vide {
    color: var(--texte-doux);
    font-style: italic;
}

/* ------------------------------------------------------------- Compteurs */

.compteurs {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
}

.compteur {
    flex: 1 1 100px;
    background: var(--fond-carte);
    border: 1px solid var(--bordure);
    border-radius: var(--rayon);
    padding: 12px 14px;
}

.compteur .valeur {
    display: block;
    font-size: 1.6rem;
    font-weight: 600;
    line-height: 1.1;
}

.compteur .etiquette {
    font-size: 0.8rem;
    color: var(--texte-doux);
}

.compteur.est-en-retard .valeur {
    color: var(--alerte);
}

.compteur.est-proche .valeur {
    color: var(--proche);
}

/* ------------------------------------------------------------------ Liste */

.liste {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.tache {
    background: var(--fond-carte);
    border: 1px solid var(--bordure);
    border-left: 4px solid var(--bordure);
    border-radius: var(--rayon);
    padding: 12px 14px;
}

.tache.est-en-retard {
    border-left-color: var(--alerte);
    background: var(--alerte-doux);
}

.tache.est-proche {
    border-left-color: var(--proche);
    background: var(--proche-doux);
}

.tache.est-terminee {
    opacity: 0.68;
}

.tache .titre {
    font-weight: 600;
}

.tache.est-terminee .titre {
    text-decoration: line-through;
}

.tache .meta {
    margin-top: 4px;
    font-size: 0.85rem;
    color: var(--texte-doux);
    display: flex;
    flex-wrap: wrap;
    gap: 4px 10px;
}

.tache .notes {
    margin: 6px 0 0;
    font-size: 0.85rem;
    color: var(--texte-doux);
}

.marque {
    display: inline-block;
    padding: 1px 8px;
    border-radius: 999px;
    background: var(--fond-doux);
    font-size: 0.78rem;
    color: var(--texte-doux);
}

.marque.est-en-retard {
    background: var(--alerte);
    color: #fff;
}

.marque.est-proche {
    background: var(--proche);
    color: #fff;
}

.marque.est-famille {
    background: var(--accent-doux);
    color: var(--accent);
}

/* ---------------------------------------------------------------- Projets */

.projets {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

@media (min-width: 560px) {
    .projets {
        grid-template-columns: repeat(2, 1fr);
    }
}

.projet {
    display: block;
    background: var(--fond-carte);
    border: 1px solid var(--bordure);
    border-radius: var(--rayon);
    padding: 12px 14px;
    text-decoration: none;
    color: inherit;
}

.projet:hover {
    border-color: var(--accent);
}

.projet .nom {
    font-weight: 600;
}

.projet .chiffres {
    margin-top: 4px;
    font-size: 0.85rem;
    color: var(--texte-doux);
}

/* ------------------------------------------------------------ Formulaire */

.connexion {
    max-width: 380px;
    margin: 8vh auto 0;
}

.connexion h1 {
    font-size: 1.3rem;
    margin: 0 0 4px;
}

.connexion .sous-titre {
    color: var(--texte-doux);
    font-size: 0.9rem;
    margin: 0 0 20px;
}

label {
    display: block;
    font-size: 0.88rem;
    color: var(--texte-doux);
    margin-bottom: 4px;
}

.champ {
    margin-bottom: 14px;
}

input[type="email"],
input[type="password"] {
    width: 100%;
    padding: 11px 12px;
    /* 17px minimum : en dessous, iOS zoome à la mise au point du champ. */
    font-size: 17px;
    font-family: inherit;
    color: var(--texte);
    background: var(--fond-carte);
    border: 1px solid var(--bordure);
    border-radius: 10px;
}

input:focus {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
}

.case {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 18px;
    font-size: 0.9rem;
    color: var(--texte);
}

.case label {
    margin: 0;
    color: inherit;
    font-size: inherit;
}

button {
    width: 100%;
    padding: 12px;
    font-size: 1rem;
    font-family: inherit;
    font-weight: 600;
    color: #fff;
    background: var(--accent);
    border: 0;
    border-radius: 10px;
    cursor: pointer;
    /* Cible tactile confortable. */
    min-height: 44px;
}

@media (prefers-color-scheme: dark) {
    button {
        color: #16151a;
    }
}

button:hover {
    filter: brightness(1.08);
}

.bouton-lien {
    width: auto;
    padding: 0;
    background: none;
    color: var(--accent);
    font-weight: 400;
    font-size: 0.9rem;
    min-height: 0;
    text-decoration: underline;
}

.bouton-lien:hover {
    filter: none;
    text-decoration: none;
}

/* -------------------------------------------------------------- Messages */

.erreurs {
    background: var(--alerte-doux);
    border: 1px solid var(--alerte);
    color: var(--alerte);
    border-radius: 10px;
    padding: 10px 12px;
    margin-bottom: 16px;
    font-size: 0.9rem;
}

.erreurs ul {
    margin: 0;
    padding-left: 18px;
}

.message {
    background: var(--accent-doux);
    border: 1px solid var(--accent);
    color: var(--accent);
    border-radius: 10px;
    padding: 10px 12px;
    margin-bottom: 16px;
    font-size: 0.9rem;
}

/* ------------------------------------------------------------------- Pied */

.pied {
    margin-top: 32px;
    padding-top: 14px;
    border-top: 1px solid var(--bordure);
    font-size: 0.8rem;
    color: var(--texte-doux);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

/* ============================================================== Étape 3 ==== */

/* ------------------------------------------------------------ Sous-tâches */

.sous-taches {
    list-style: none;
    margin: 10px 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.sous-tache {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    background: var(--fond-doux);
    border-radius: 10px;
    padding: 10px 12px;
}

.sous-tache.est-terminee .intitule {
    text-decoration: line-through;
    opacity: 0.7;
}

.sous-tache .corps {
    flex: 1;
    min-width: 0;
}

.sous-tache .intitule {
    font-weight: 500;
}

.sous-tache .details {
    font-size: 0.82rem;
    color: var(--texte-doux);
    display: flex;
    flex-wrap: wrap;
    gap: 3px 8px;
    margin-top: 2px;
}

.sous-tache .rangees {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

/* Boutons compacts pour cocher, monter, descendre. */
.bouton-icone {
    width: 36px;
    min-height: 32px;
    padding: 0;
    font-size: 0.95rem;
    line-height: 1;
    background: var(--fond-carte);
    color: var(--texte);
    border: 1px solid var(--bordure);
    border-radius: 8px;
}

.bouton-icone:hover {
    filter: none;
    border-color: var(--accent);
}

.bouton-icone.est-cochee {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

@media (prefers-color-scheme: dark) {
    .bouton-icone.est-cochee {
        color: #16151a;
    }
}

.compteur-sous-taches {
    font-size: 0.8rem;
    color: var(--texte-doux);
}

/* ------------------------------------------------------------- Formulaires */

.grille-champs {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

@media (min-width: 560px) {
    .grille-champs.deux {
        grid-template-columns: 1fr 1fr;
    }
}

select,
textarea,
input[type="text"],
input[type="number"],
input[type="date"] {
    width: 100%;
    padding: 10px 12px;
    font-size: 17px;
    font-family: inherit;
    color: var(--texte);
    background: var(--fond-carte);
    border: 1px solid var(--bordure);
    border-radius: 10px;
}

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

.champ-compact {
    margin-bottom: 0;
}

details.bloc {
    background: var(--fond-carte);
    border: 1px solid var(--bordure);
    border-radius: var(--rayon);
    padding: 12px 14px;
    margin-bottom: 12px;
}

details.bloc > summary {
    cursor: pointer;
    font-weight: 600;
    font-size: 0.95rem;
}

details.bloc > summary + * {
    margin-top: 14px;
}

/* ----------------------------------------------------------------- Actions */

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.actions form {
    flex: 0 0 auto;
}

.bouton-secondaire {
    width: auto;
    padding: 8px 14px;
    font-size: 0.88rem;
    font-weight: 500;
    background: var(--fond-doux);
    color: var(--texte);
    border: 1px solid var(--bordure);
    min-height: 40px;
}

.bouton-secondaire:hover {
    filter: none;
    border-color: var(--accent);
}

.bouton-secondaire.est-actif {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

@media (prefers-color-scheme: dark) {
    .bouton-secondaire.est-actif {
        color: #16151a;
    }
}

.bouton-danger {
    background: var(--alerte-doux);
    color: var(--alerte);
    border-color: var(--alerte);
}

.bouton-large {
    width: 100%;
}

/* --------------------------------------------------------------- Corbeille */

.corbeille-ligne {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: var(--fond-carte);
    border: 1px solid var(--bordure);
    border-radius: var(--rayon);
    padding: 12px 14px;
}

.corbeille-ligne .corps {
    min-width: 0;
}

.corbeille-ligne .quand {
    font-size: 0.82rem;
    color: var(--texte-doux);
    margin-top: 2px;
}

.bientot-purge {
    color: var(--alerte);
}

.explication {
    font-size: 0.86rem;
    color: var(--texte-doux);
    margin: 0 0 14px;
}
