/* Actions : style minimaliste, mode sombre par défaut (réglable dans les Préférences). */

:root {
    color-scheme: light;
    --fond: #f7f7f5; --carte: #ffffff; --encre: #16181b; --doux: #6b7078; --ligne: #e5e5e1; --champ: #ffffff;
    --accent: #2f6fdb; --accent-doux: #e4edfb; --sur-accent: #ffffff; --alerte: #c2412d; --alerte-doux: #fbe9e6;
    --rayon: 14px;
}
[data-theme="sombre"] {
    color-scheme: dark;
    --fond: #0f1115; --carte: #171a20; --encre: #eceef2; --doux: #8f95a0; --ligne: #272b33; --champ: #1d2027;
    --accent: #7aa7ff; --accent-doux: #1b2740; --sur-accent: #0f1115; --alerte: #f07a63; --alerte-doux: #3a1f1a;
}

* { box-sizing: border-box; }
html { -webkit-tap-highlight-color: transparent; }
body { margin: 0; background: var(--fond); color: var(--encre); font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
body.avec-navigation { padding-bottom: calc(5rem + env(safe-area-inset-bottom)); }
a { color: inherit; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
main { max-width: 560px; margin: 0 auto; padding: calc(1.25rem + env(safe-area-inset-top)) 1rem 2rem; }
h1 { font-size: 1.7rem; line-height: 1.15; margin: .25rem 0; letter-spacing: -.01em; }
.sous-titre { color: var(--doux); margin: 0 0 1.25rem; }
.entete .sous-titre { margin-bottom: 1rem; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.flash { margin: 0 0 1rem; padding: .7rem .9rem; border-radius: var(--rayon); background: var(--accent-doux); color: var(--accent); font-weight: 500; }
.flash-erreur { background: var(--alerte-doux); color: var(--alerte); }
.vide { margin: 1.5rem 0; padding: 2rem 1rem; text-align: center; color: var(--doux); border: 1px dashed var(--ligne); border-radius: var(--rayon); }
.chargement { opacity: .6; transition: opacity .15s; }
.pastille { padding: .05rem .5rem; border-radius: 999px; background: var(--accent); color: var(--sur-accent); font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; vertical-align: middle; }

/* Barre de navigation : boutons d'émoji, en bas de l'écran. */
.navigation { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; display: flex; justify-content: center; gap: .25rem;
              padding: .5rem .75rem calc(.5rem + env(safe-area-inset-bottom)); background: var(--carte); border-top: 1px solid var(--ligne); }
.onglet { flex: 1; max-width: 5rem; display: flex; align-items: center; justify-content: center; height: 3rem; border-radius: 12px;
          font-size: 1.45rem; line-height: 1; text-decoration: none; filter: grayscale(.85); opacity: .7; transition: background .15s, opacity .15s, filter .15s; }
.onglet:hover, .onglet:focus-visible { opacity: 1; filter: none; }
.onglet[aria-current="page"] { background: var(--accent-doux); opacity: 1; filter: none; }

/* Filtres de période : une rangée de pastilles, défilante sur téléphone. */
.filtres { display: flex; gap: .4rem; overflow-x: auto; margin: 0 -1rem 1rem; padding: 0 1rem .25rem; scrollbar-width: none; }
.filtres::-webkit-scrollbar { display: none; }
.filtres a { flex: none; padding: .45rem .85rem; border: 1px solid var(--ligne); border-radius: 999px; background: var(--carte);
             color: var(--doux); font-size: .9rem; font-weight: 600; text-decoration: none; white-space: nowrap; }
.filtres a:hover { color: var(--encre); border-color: var(--doux); }
.filtres a[aria-current] { background: var(--accent); border-color: var(--accent); color: var(--sur-accent); }

/* Ajout rapide */
.ajout { margin: 0 0 1.25rem; border: 1px solid var(--ligne); border-radius: var(--rayon); background: var(--carte); }
.ajout summary { list-style: none; cursor: pointer; padding: .7rem .9rem; font-weight: 600; color: var(--doux); }
.ajout summary::-webkit-details-marker { display: none; }
.ajout[open] summary { color: var(--encre); }
.formulaire-ajout { display: grid; gap: .6rem; padding: 0 .9rem .9rem; }
.formulaire-ajout input[type="text"], .formulaire-ajout input[type="date"], .formulaire-ajout input[type="time"],
.formulaire-edition input[type="text"], .formulaire-edition input[type="date"], .formulaire-edition input[type="time"] {
    width: 100%; min-width: 0; padding: .6rem .7rem; border: 1px solid var(--ligne); border-radius: 10px; background: var(--champ); }
.formulaire-ajout input:focus, .formulaire-edition input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.aide { margin: -.2rem 0 0; font-size: .8rem; color: var(--doux); }
.ligne-titre { display: grid; grid-template-columns: 3.2rem 1fr; gap: .5rem; }
.champ-emoji { text-align: center; }
.ligne-quand { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }
.ligne-quand label { display: grid; gap: .2rem; font-size: .8rem; color: var(--doux); font-weight: 600; }
.case-evenement { display: flex; align-items: center; gap: .5rem; color: var(--doux); }
.case-evenement input { accent-color: var(--accent); width: 1.1rem; height: 1.1rem; margin: 0; }

/* Liste, jour par jour */
.jour { margin: 0 0 1.25rem; }
.jour h2 { margin: 0 0 .5rem; font-size: 1.05rem; font-weight: 700; }
.jour.aujourdhui > h2 { color: var(--accent); }
.jour.en-retard > h2 { color: var(--alerte); }
.horaire { margin: .85rem 0 .4rem; font-size: .95rem; font-weight: 700; color: var(--doux); font-variant-numeric: tabular-nums; }
.elements { list-style: none; margin: 0; padding: 0; display: grid; gap: .35rem; }

.element { width: 100%; display: flex; align-items: center; gap: .7rem; min-height: 3rem; padding: .35rem .4rem .35rem .75rem; text-align: left;
           background: var(--carte); border: 1px solid var(--ligne); border-radius: 12px; transition: background .15s, border-color .15s; }
/* Seule la case coche ; sa zone d'appui (::before) déborde pour rester facile à toucher. */
.element .case { position: relative; flex: none; width: 1.35rem; height: 1.35rem; padding: 0; border-radius: 50%; border: 2px solid var(--doux); background: transparent;
                 display: flex; align-items: center; justify-content: center; transition: border-color .15s, background .15s; }
.element .case::before { content: ""; position: absolute; inset: -.65rem; }
.element .case:hover, .element .case:focus-visible { border-color: var(--accent); }
/* ✏️ et 🗑️ : discrets, en couleur au survol. */
.outils { flex: none; display: flex; align-items: center; gap: .1rem; }
.outil { width: 2.25rem; height: 2.25rem; padding: 0; border: 0; border-radius: 10px; background: transparent; font-size: 1rem; line-height: 1;
         display: flex; align-items: center; justify-content: center; opacity: .55; filter: grayscale(.7); transition: opacity .15s, filter .15s, background .15s; }
.outil:hover, .outil:focus-visible { opacity: 1; filter: none; background: var(--accent-doux); }
.element .emoji { flex: none; font-size: 1.2rem; line-height: 1; }
.element .texte { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.element .titre { font-weight: 500; overflow-wrap: anywhere; }
.element .note { color: var(--doux); font-size: .82rem; }
.element.faite { background: transparent; border-style: dashed; }
.element.faite .case { background: var(--accent); border-color: var(--accent); }
.element.faite .case::after { content: ""; width: .4rem; height: .7rem; margin-top: -.15rem; border: solid var(--sur-accent); border-width: 0 2.5px 2.5px 0; transform: rotate(45deg); }
.element.faite .titre { color: var(--doux); text-decoration: line-through; text-decoration-thickness: 1px; }
.element.evenement { border-left: 3px solid var(--accent); }
.en-retard .element:not(.faite) .case { border-color: var(--alerte); }

/* En attente (actions sans date), tout en haut */
.jour.en-attente > h2 { color: var(--doux); }
.vide-attente { margin: 0; padding: .6rem .8rem; color: var(--doux); font-size: .9rem; border: 1px dashed var(--ligne); border-radius: 12px; }

/* Modification sur place */
.formulaire-edition { display: grid; gap: .6rem; padding: .75rem; background: var(--carte); border: 1px solid var(--accent); border-radius: 12px; }
.formulaire-edition .flash { margin: 0; }
.boutons-edition { display: flex; gap: .5rem; justify-content: flex-end; }
.boutons-edition .annuler { padding: .6rem 1.1rem; border: 1px solid var(--ligne); border-radius: 999px; background: var(--champ); font-weight: 600; }

/* Préférences */
.panneau { margin: 0 0 1rem; padding: 1.1rem; background: var(--carte); border: 1px solid var(--ligne); border-radius: var(--rayon); }
.panneau h2 { margin: 0 0 .8rem; font-size: 1.1rem; }
.choix-theme { border: 0; margin: 0 0 1rem; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; }
.option-theme { display: flex; align-items: center; gap: .6rem; padding: .8rem .9rem; border: 1px solid var(--ligne); border-radius: 12px; background: var(--champ); font-weight: 600; cursor: pointer; }
.option-theme:has(input:checked) { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.option-theme input { accent-color: var(--accent); width: 1.1rem; height: 1.1rem; margin: 0; }
.bouton { display: inline-block; border: 0; border-radius: 999px; padding: .65rem 1.4rem; background: var(--accent); color: var(--sur-accent); font-weight: 700; text-decoration: none; text-align: center; }
.details { color: var(--doux); font-size: .9rem; margin: .6rem 0 0; }
.application-android ol { margin: .9rem 0 0; padding-left: 1.2rem; color: var(--doux); font-size: .95rem; }
@media (max-width: 420px) { .choix-theme { grid-template-columns: 1fr; } .bouton { width: 100%; } }

/* Connexion */
.connexion { max-width: 360px; margin: 3rem auto; text-align: center; }
.connexion .logo { font-size: 3rem; margin: 0; line-height: 1; }
.connexion label { display: block; text-align: left; font-weight: 600; margin: 1.25rem 0 .35rem; }
.connexion input[type="password"] { width: 100%; font-size: 1.1rem; padding: .8rem .9rem; border: 1px solid var(--ligne); border-radius: 12px; background: var(--champ); color: var(--encre); }
.connexion input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.connexion .bouton { width: 100%; margin-top: 1.25rem; padding: .85rem; font-size: 1.05rem; }
.erreur { padding: .7rem .9rem; border-radius: 12px; background: var(--champ); border: 1px solid var(--alerte); color: var(--alerte); }

/* Fenêtre de confirmation (déconnexion) : centrée, ou en bas de l'écran sur téléphone. */
dialog.confirmation { width: min(92vw, 360px); padding: 1.3rem; border: 1px solid var(--ligne); border-radius: 18px; background: var(--carte); color: var(--encre); }
dialog.confirmation::backdrop { background: rgba(0, 0, 0, .55); }
.confirmation-titre { font-size: 1.2rem; margin: 0 0 .35rem; }
.confirmation p { margin: 0 0 1.2rem; color: var(--doux); }
.confirmation-boutons { display: flex; gap: .6rem; justify-content: flex-end; }
.confirmation-boutons > * { min-height: 2.75rem; padding: .6rem 1.1rem; border-radius: 12px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.confirmation .annuler { background: var(--champ); border: 1px solid var(--ligne); }
.confirmation .confirmation-oui { background: var(--alerte); color: #fff; border: 1px solid var(--alerte); }
@media (max-width: 480px) {
    dialog.confirmation { width: 100%; max-width: 100%; margin: auto 0 0; border-radius: 18px 18px 0 0; padding-bottom: calc(1.3rem + env(safe-area-inset-bottom)); }
    .confirmation-boutons { flex-direction: column-reverse; }
    .confirmation-boutons > * { width: 100%; }
}
