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

:root {
    color-scheme: light;
    --fond: #f6f7f6; --carte: #ffffff; --encre: #15181a; --doux: #687076; --ligne: #e3e6e4; --champ: #ffffff;
    --accent: #0f8a66; --accent-doux: #dcf2ea; --sur-accent: #ffffff;
    --attention: #a86a12; --attention-doux: #fbf0dc; --alerte: #c2412d; --alerte-doux: #fbe9e6;
    --rayon: 14px;
    /* Couleurs de la répartition du disque et des parties d'un site. */
    --c-sites: #0f8a66; --c-socle: #3f6fd8; --c-images: #8a63d2; --c-cache: #c48a1c; --c-ci: #e2622b; --c-autres: #8d969c; --c-systeme: #c7cdd1;
    --c-donnees: #0f8a66; --c-code: #3f6fd8; --c-conteneurs: #c48a1c; --c-volumes: #138fa3; --c-journaux_web: #8d969c;
}
[data-theme="sombre"] {
    color-scheme: dark;
    --fond: #0e1113; --carte: #161a1d; --encre: #e9eef0; --doux: #8b959c; --ligne: #252b2f; --champ: #1b2024;
    --accent: #4fd1a5; --accent-doux: #12312a; --sur-accent: #0b1512;
    --attention: #f0b44c; --attention-doux: #3a2d14; --alerte: #f07a63; --alerte-doux: #3a1f1a;
    --c-sites: #4fd1a5; --c-socle: #6b8afd; --c-images: #a98bfa; --c-cache: #f0b44c; --c-ci: #fc7d43; --c-autres: #7d878e; --c-systeme: #3c454b;
    --c-donnees: #4fd1a5; --c-code: #6b8afd; --c-conteneurs: #f0b44c; --c-volumes: #4cc3d9; --c-journaux_web: #7d878e;
}

* { box-sizing: border-box; }
html { -webkit-tap-highlight-color: transparent; -webkit-text-size-adjust: 100%; }
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, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
main { max-width: 600px; 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; }
h2 { font-size: 1.05rem; margin: 0 0 .6rem; }
.sous-titre { color: var(--doux); margin: 0 0 1.25rem; }
.details { color: var(--doux); font-size: .9rem; margin: .6rem 0 0; }
.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: 1rem 0; padding: 1.5rem 1rem; text-align: center; color: var(--doux); border: 1px dashed var(--ligne); border-radius: var(--rayon); }
.chiffres-tabulaires, .taille { font-variant-numeric: tabular-nums; }

/* En-tête d'une page : titre à gauche, bouton (🔄, ➕) à droite. */
.entete { display: flex; align-items: flex-start; gap: .75rem; }
.entete > div { flex: 1; min-width: 0; }
.entete .sous-titre { margin-bottom: 1rem; }
.bouton-icone { flex: none; width: 2.9rem; height: 2.9rem; padding: 0; border: 1px solid var(--ligne); border-radius: 12px; background: var(--carte);
                display: inline-flex; align-items: center; justify-content: center; font-size: 1.15rem; line-height: 1; text-decoration: none;
                transition: border-color .15s, background .15s; }
.bouton-icone:hover, .bouton-icone:focus-visible { border-color: var(--accent); }
.en-cours .bouton-icone span { display: inline-block; animation: tourne 1.2s linear infinite; }
@keyframes tourne { to { transform: rotate(360deg); } }
form.inline { margin: 0; }

/* Barre de navigation : boutons d'émoji, en bas de l'écran (à portée de pouce). */
.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; }

/* Cartes et boutons */
.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; }
.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; }
.bouton-secondaire { display: inline-flex; align-items: center; gap: .4rem; padding: .55rem 1rem; border: 1px solid var(--ligne); border-radius: 999px;
                     background: var(--champ); font-weight: 600; text-decoration: none; }
.bouton-secondaire:hover, .bouton-secondaire:focus-visible { border-color: var(--accent); }
.bouton-secondaire.danger { color: var(--alerte); }
.boutons { display: flex; flex-wrap: wrap; gap: .5rem; margin: 1rem 0 0; }

/* Résumé du disque, en tête de la liste des sites (lien vers 💾 Stockage). */
.resume-disque { display: block; margin: 0 0 1.25rem; padding: .8rem .9rem; background: var(--carte); border: 1px solid var(--ligne); border-radius: var(--rayon);
                 text-decoration: none; transition: border-color .15s; }
.resume-disque:hover, .resume-disque:focus-visible { border-color: var(--accent); }
.resume-ligne { display: flex; align-items: baseline; gap: .5rem; font-weight: 600; }
.resume-ligne .pourcent { margin-left: auto; color: var(--doux); font-variant-numeric: tabular-nums; }

/* Jauge : une barre et son remplissage (largeur en style="--valeur: 46%"). */
.jauge { position: relative; display: block; height: .55rem; margin-top: .55rem; border-radius: 999px; background: var(--ligne); overflow: hidden; }
.jauge > span { position: absolute; inset: 0 auto 0 0; width: var(--valeur, 0%); border-radius: inherit; background: var(--accent); }
.jauge.attention > span { background: var(--attention); }
.jauge.critique > span { background: var(--alerte); }
.jauge.grande { height: .9rem; }

/* Liste des sites : toute la ligne est le lien vers le site ; ⋯ ouvre sa fiche. */
.sites { list-style: none; margin: 0; padding: 0; display: grid; gap: .45rem; }
.site { display: flex; align-items: stretch; background: var(--carte); border: 1px solid var(--ligne); border-radius: 12px; overflow: hidden;
        transition: border-color .15s; }
.site:hover, .site:focus-within { border-color: var(--accent); }
.site-lien { flex: 1; min-width: 0; display: flex; align-items: center; gap: .75rem; padding: .65rem .3rem .65rem .8rem; text-decoration: none; }
.site-emoji { flex: none; width: 2.3rem; height: 2.3rem; display: flex; align-items: center; justify-content: center; border-radius: 10px;
              background: var(--fond); font-size: 1.3rem; line-height: 1; }
.site-texte { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.site-titre { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.site-hote { display: flex; align-items: center; gap: .35rem; color: var(--doux); font-size: .82rem; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.site-taille { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: .3rem; min-width: 4.5rem; font-size: .88rem; font-weight: 600;
               font-variant-numeric: tabular-nums; }
.site-taille .barre { width: 4.5rem; height: .25rem; border-radius: 999px; background: var(--ligne); overflow: hidden; }
.site-taille .barre > span { display: block; height: 100%; width: var(--valeur, 0%); background: var(--accent); border-radius: inherit; }
.site-plus { flex: none; width: 2.75rem; display: flex; align-items: center; justify-content: center; color: var(--doux); font-size: 1.3rem; font-weight: 700;
             text-decoration: none; border-left: 1px solid var(--ligne); transition: background .15s, color .15s; }
.site-plus:hover, .site-plus:focus-visible { background: var(--accent-doux); color: var(--accent); }
.site.absent { opacity: .6; }

/* Pastille d'état : en ligne, arrêté, inconnu. */
.etat { flex: none; width: .55rem; height: .55rem; border-radius: 50%; background: var(--doux); }
.etat-en_ligne { background: var(--accent); }
.etat-arrete, .etat-absent, .etat-plus { background: var(--alerte); }
.etat-manuel { background: transparent; border: 1.5px solid var(--doux); }

.masques { margin: 1.25rem 0 0; }
.masques > summary { width: fit-content; color: var(--doux); font-weight: 600; cursor: pointer; margin-bottom: .6rem; }
.releve { margin: 1.25rem 0 0; color: var(--doux); font-size: .85rem; text-align: center; }
.releve.en-attente { color: var(--accent); }
.releve.sans-reponse { color: var(--attention); }

/* Stockage : chiffres du disque, répartition en barre empilée, légende, évolution. */
.disque-chiffres { display: flex; align-items: baseline; gap: .5rem; flex-wrap: wrap; }
.disque-chiffres strong { font-size: 1.9rem; line-height: 1.1; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.disque-chiffres .pourcent { margin-left: auto; font-size: 1.25rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.disque-chiffres .pourcent.attention { color: var(--attention); }
.disque-chiffres .pourcent.critique { color: var(--alerte); }
.empilee { display: flex; height: .9rem; margin: .2rem 0 .9rem; border-radius: 999px; overflow: hidden; background: var(--ligne); }
.empilee > span { height: 100%; min-width: 2px; }
.legende { list-style: none; margin: 0; padding: 0; display: grid; gap: .1rem; }
.legende li { display: grid; grid-template-columns: .7rem 1fr auto; align-items: baseline; column-gap: .6rem; padding: .35rem 0; border-bottom: 1px solid var(--ligne); }
.legende li:last-child { border-bottom: 0; }
.legende .pastille { width: .7rem; height: .7rem; border-radius: 3px; align-self: center; }
.legende .nom { min-width: 0; }
.legende .aide { display: block; color: var(--doux); font-size: .78rem; line-height: 1.35; }
.legende .valeur { font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; }
.legende .valeur small { display: block; color: var(--doux); font-size: .75rem; font-weight: 500; }
.systeme { display: flex; flex-wrap: wrap; gap: .35rem 1.1rem; margin: 0; padding: 0; list-style: none; color: var(--doux); font-size: .88rem; }
.systeme strong { color: var(--encre); font-variant-numeric: tabular-nums; }

/* Classement des sites (Stockage) */
.classement { list-style: none; margin: 0; padding: 0; display: grid; gap: .55rem; }
.classement a { display: grid; grid-template-columns: 1.6rem 1fr auto; align-items: center; column-gap: .55rem; text-decoration: none; }
.classement .emoji { text-align: center; font-size: 1.1rem; }
.classement .nom { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.classement .valeur { font-weight: 600; font-variant-numeric: tabular-nums; }
.classement .jauge { grid-column: 2 / 4; margin-top: .3rem; height: .3rem; }
.classement a:hover .nom, .classement a:focus-visible .nom { color: var(--accent); }

/* Évolution : une colonne par jour (hauteur en style="--valeur: 72%"). */
.evolution { display: flex; align-items: flex-end; gap: 2px; height: 5.5rem; margin: .4rem 0 .3rem; }
.evolution > span { flex: 1; min-width: 2px; height: var(--valeur, 0%); border-radius: 3px 3px 0 0; background: var(--accent); opacity: .85; }
.evolution > span:last-child { opacity: 1; }
.evolution-bornes { display: flex; justify-content: space-between; color: var(--doux); font-size: .78rem; }

/* Fiche d'un site */
.retour { margin: 0 0 .35rem; }
.retour a { color: var(--accent); font-weight: 600; text-decoration: none; }
.fiche-titre { display: flex; align-items: center; gap: .75rem; }
.fiche-titre .site-emoji { width: 3rem; height: 3rem; font-size: 1.7rem; background: var(--carte); border: 1px solid var(--ligne); }
.fiche-titre h1 { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.domaines { list-style: none; margin: .8rem 0 0; padding: 0; display: grid; gap: .35rem; }
.domaines a { display: inline-flex; align-items: center; gap: .4rem; color: var(--accent); font-weight: 600; text-decoration: none; overflow-wrap: anywhere; }
.domaines a:hover, .domaines a:focus-visible { text-decoration: underline; }
.infos { display: flex; flex-wrap: wrap; gap: .3rem .9rem; margin: .7rem 0 1rem; color: var(--doux); font-size: .88rem; }
.infos span { display: inline-flex; align-items: center; gap: .35rem; }
.description { margin: 0 0 1rem; white-space: pre-line; }
.badge { padding: .05rem .5rem; border-radius: 999px; background: var(--ligne); color: var(--doux); font-size: .75rem; font-weight: 700; }
.sous-dossiers { margin: .1rem 0 0; color: var(--doux); font-size: .78rem; }

/* Formulaires */
.formulaire { display: grid; gap: .9rem; }
.formulaire label { display: grid; gap: .3rem; font-size: .85rem; color: var(--doux); font-weight: 600; }
.formulaire input[type="text"], .formulaire input[type="url"], .formulaire input[type="number"], .formulaire textarea {
    width: 100%; min-width: 0; padding: .65rem .75rem; border: 1px solid var(--ligne); border-radius: 10px; background: var(--champ); color: var(--encre); font-weight: 400; }
.formulaire textarea { min-height: 5.5rem; resize: vertical; }
.formulaire input:focus, .formulaire textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.ligne-titre { display: grid; grid-template-columns: 4.2rem 1fr; gap: .6rem; }
.champ-emoji { text-align: center; font-size: 1.3rem; }
.aide { margin: 0; font-size: .8rem; color: var(--doux); font-weight: 400; }
.erreur { margin: 0; padding: .7rem .9rem; border-radius: 12px; background: var(--alerte-doux); color: var(--alerte); font-weight: 500; }
.boutons-formulaire { display: flex; justify-content: flex-end; gap: .5rem; }
.boutons-formulaire a { padding: .65rem 1.1rem; border: 1px solid var(--ligne); border-radius: 999px; background: var(--champ); font-weight: 600; text-decoration: none; }

/* Préférences */
.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; }
.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; } .panneau .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; }
.connexion .erreur { margin-top: 1rem; }

/* Fenêtres de confirmation (déconnexion, suppression) : centrées, 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 > *, .confirmation-boutons form button { 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 > *, .confirmation-boutons form, .confirmation-boutons form button { width: 100%; }
}
