/* Habitudes : 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: #2f9e5b; --accent-doux: #e3f3e9; --sur-accent: #ffffff; --alerte: #c2412d;
    --rayon: 14px;
}
[data-theme="sombre"] {
    color-scheme: dark;
    --fond: #0e1012; --carte: #16191c; --encre: #eceef0; --doux: #8d939b; --ligne: #262a2f; --champ: #1c2024;
    --accent: #5fd08a; --accent-doux: #173322; --sur-accent: #0e1012; --alerte: #f07a63;
}

* { 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 { font: inherit; color: inherit; 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.5rem; }
.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; }
.vide { margin: 2rem 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; }

/* 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; }

/* Journée */
.entete-jour { display: grid; grid-template-columns: 2.75rem 1fr 2.75rem; align-items: center; gap: .5rem; margin-bottom: 1rem; }
.titre-jour { text-align: center; }
.titre-jour p { margin: 0; color: var(--doux); font-size: .95rem; }
.fleche { display: flex; align-items: center; justify-content: center; width: 2.75rem; height: 2.75rem; border-radius: 50%;
          font-size: 1.8rem; line-height: 1; text-decoration: none; color: var(--doux); border: 1px solid var(--ligne); }
.fleche:hover { color: var(--encre); border-color: var(--doux); }
.fleche.inactive { opacity: .25; }
.progression { display: flex; align-items: center; gap: .75rem; margin: 0 0 1.25rem; }
.barre { flex: 1; height: .5rem; border-radius: 999px; background: var(--ligne); overflow: hidden; }
.barre > span { display: block; height: 100%; border-radius: inherit; background: var(--accent); transition: width .25s ease; }
.compte { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--doux); }
.bravo { text-align: center; margin: -.5rem 0 1.25rem; color: var(--accent); font-weight: 600; }

.creneau { margin: 0 0 1rem; padding: .9rem; background: var(--carte); border: 1px solid var(--ligne); border-radius: var(--rayon); }
.creneau.maintenant { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.creneau > header { display: flex; align-items: baseline; gap: .6rem; margin: 0 0 .6rem; }
.creneau time { font-size: 1.15rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.creneau h2 { margin: 0; font-size: 1rem; font-weight: 600; color: var(--doux); }
.creneau .sous-compte { margin-left: auto; color: var(--doux); font-size: .85rem; font-variant-numeric: tabular-nums; }
.creneau.complet .sous-compte { color: var(--accent); }
.pastille { padding: .05rem .5rem; border-radius: 999px; background: var(--accent); color: var(--sur-accent); font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.creneau ul { list-style: none; margin: 0; padding: 0; display: grid; gap: .4rem; }

.habitude { width: 100%; display: flex; align-items: center; gap: .75rem; min-height: 3.25rem; padding: .55rem .75rem; text-align: left;
            background: var(--champ); border: 1px solid var(--ligne); border-radius: 12px; transition: background .15s, border-color .15s; }
.habitude:hover:not([disabled]) { border-color: var(--doux); }
.habitude[disabled] { cursor: default; }
.habitude .case { flex: none; width: 1.5rem; height: 1.5rem; border-radius: 50%; border: 2px solid var(--doux); display: flex; align-items: center; justify-content: center; }
.habitude .emoji { font-size: 1.25rem; line-height: 1; }
.habitude .nom { flex: 1; font-weight: 500; }
.habitude.faite { background: var(--accent-doux); border-color: transparent; }
.habitude.faite .case { background: var(--accent); border-color: var(--accent); }
.habitude.faite .case::after { content: ""; width: .45rem; height: .8rem; margin-top: -.15rem; border: solid var(--sur-accent); border-width: 0 2.5px 2.5px 0; transform: rotate(45deg); }
.habitude.faite .nom { color: var(--doux); text-decoration: line-through; text-decoration-thickness: 1px; }

/* Semaine */
.semaine { display: grid; gap: .75rem; }
.jour { padding: .9rem; background: var(--carte); border: 1px solid var(--ligne); border-radius: var(--rayon); }
.jour.aujourdhui { border-color: var(--accent); }
.jour h2 { display: flex; align-items: baseline; justify-content: space-between; margin: 0 0 .5rem; font-size: 1.05rem; }
.jour h2 a { text-decoration: none; }
.jour.aujourdhui h2 a { color: var(--accent); }
.jour .date { color: var(--doux); font-weight: 400; font-size: .85rem; }
.jour .rien { margin: 0; color: var(--doux); }
.creneaux { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.creneaux li { display: grid; grid-template-columns: 3.4rem 1fr; gap: .5rem; }
.creneaux time { font-weight: 700; font-variant-numeric: tabular-nums; }
.creneaux strong { display: block; font-weight: 600; font-size: .9rem; color: var(--doux); }
.actions { display: flex; flex-wrap: wrap; gap: .3rem; }
.action { padding: .1rem .55rem; border-radius: 999px; background: var(--champ); border: 1px solid var(--ligne); font-size: .88rem; }
.action.inactive { opacity: .45; text-decoration: line-through; }

/* Suivi */
.periode { display: inline-flex; margin: .5rem 0 1.25rem; border: 1px solid var(--ligne); border-radius: 999px; overflow: hidden; }
.periode a { padding: .45rem 1rem; text-decoration: none; color: var(--doux); font-weight: 600; }
.periode a[aria-current] { background: var(--accent); color: var(--sur-accent); }
.bilan { display: flex; align-items: baseline; gap: .75rem; margin: 0 0 1.5rem; }
.bilan .taux { font-size: 2.6rem; font-weight: 800; line-height: 1; color: var(--accent); }
.bilan .detail { color: var(--doux); }
.titre-section { font-size: .78rem; letter-spacing: .1em; text-transform: uppercase; color: var(--doux); margin: 1.5rem 0 .6rem; }
.barres { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.barres li { display: grid; grid-template-columns: minmax(6.5rem, 40%) 1fr 3.2rem; align-items: center; gap: .75rem; }
.barres .libelle { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-decoration: none; }
.barres .chiffre { text-align: right; color: var(--doux); font-variant-numeric: tabular-nums; font-size: .9rem; }
.barres .vide-barre { opacity: .4; }

/* 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: inherit; 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%; }
}
