/* ARC-LOUD — écrans redessinés d'après les maquettes de référence.
 *
 * Ces styles complètent ceux du prototype : ils n'en remplacent aucun, et
 * reprennent ses jetons de couleur pour suivre le thème clair ou sombre sans
 * duplication.
 */

/* --- Lisibilité du texte ------------------------------------------------ */

/* Le prototype écrivait tout le texte secondaire — libellés, descriptions,
 * unités, dates — dans un bleu-gris très pâle (#74829C sur blanc). Sur un
 * écran d'ordinateur portable en plein jour, et plus encore sur un téléphone
 * en extérieur, cela devient illisible. Ces trois jetons commandent presque
 * tout le texte secondaire de l'application : les repasser en encre sombre
 * suffit à rendre l'ensemble lisible, sans toucher un seul écran.
 *
 * Les surfaces sombres (menu de gauche, en-têtes de l'espace agent) fixent
 * leurs propres couleurs claires et ne sont donc pas concernées. */
:root {
    --muted: #202735;
    --p-muted: #202735;
    --arc-muted: #202735;
    --ink: #202735;
    --p-ink: #202735;
}

/* En thème sombre, du texte noir serait invisible : on y garde un ton clair. */
:root[data-theme="sombre"],
body.arc-dark {
    --muted: #e8edf7;
    --p-muted: #e8edf7;
    --arc-muted: #e8edf7;
    --ink: #f3f6fc;
    --p-ink: #f3f6fc;
}

@media (prefers-color-scheme: dark) {
    :root[data-theme="auto"] {
        --muted: #e8edf7;
        --p-muted: #e8edf7;
        --arc-muted: #e8edf7;
        --ink: #f3f6fc;
        --p-ink: #f3f6fc;
    }
}

/* --- En-tête d'écran --------------------------------------------------- */

.al-entete {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    margin: 2px 0 20px;
}

.al-entete-titre { display: flex; align-items: flex-start; gap: 14px; min-width: 0; }

.al-entete-icone {
    display: grid;
    place-items: center;
    width: 52px;
    height: 52px;
    border-radius: 13px;
    background: var(--p-blue);
    color: #fff;
    flex: 0 0 auto;
}

.al-entete h1 { margin: 0 0 4px; font-size: 25px; letter-spacing: -.01em; }
.al-entete p { margin: 0; color: var(--p-muted); font-size: 13px; }

/* --- Cartes de synthèse ------------------------------------------------ */

.al-chiffres {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 15px;
    margin-bottom: 18px;
}

.al-chiffre {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 17px 18px;
    background: var(--p-card);
    border: 1px solid var(--p-border);
    border-radius: 13px;
    box-shadow: var(--p-shadow);
}

.al-chiffre-icone {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: 11px;
    background: var(--p-tint);
    color: var(--p-blue);
    flex: 0 0 auto;
}

.al-chiffre-corps { min-width: 0; }
.al-chiffre-valeur { display: flex; align-items: center; gap: 9px; }
.al-chiffre-valeur b { font-size: 25px; line-height: 1.1; letter-spacing: -.02em; }
.al-chiffre-libelle { font-size: 12.5px; font-weight: 600; margin-top: 1px; }
.al-chiffre-detail { font-size: 11px; color: var(--p-muted); margin-top: 2px; }

.al-tendance {
    font-size: 10.5px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 999px;
    background: rgba(47, 163, 107, .14);
    color: #2fa36b;
}

/* --- Disposition tableau + panneau ------------------------------------- */

.al-colonnes { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-items: start; }
.al-colonnes.avec-panneau { grid-template-columns: minmax(0, 1fr) 320px; }

.al-cadre {
    background: var(--p-card);
    border: 1px solid var(--p-border);
    border-radius: 13px;
    box-shadow: var(--p-shadow);
    overflow: hidden;
}

/* --- Barre de filtres --------------------------------------------------- */

.al-filtres {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    flex-wrap: wrap;
}

.al-recherche { position: relative; flex: 1 1 200px; min-width: 170px; }
.al-recherche input { width: 100%; padding-left: 34px; }

.al-recherche svg {
    position: absolute;
    left: 11px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--p-muted);
    pointer-events: none;
}

.al-filtres select { min-width: 132px; flex: 0 1 auto; }
.al-filtres > button { flex: 0 0 auto; white-space: nowrap; }

/* --- Tableau ------------------------------------------------------------ */

.al-tableau { width: 100%; border-collapse: collapse; font-size: 13px; }
.al-tableau th {
    text-align: left;
    padding: 11px 14px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .02em;
    color: var(--p-muted);
    background: var(--p-bg);
    border-top: 1px solid var(--p-border);
    border-bottom: 1px solid var(--p-border);
    white-space: nowrap;
}
.al-tableau td { padding: 11px 14px; border-bottom: 1px solid var(--p-border); vertical-align: middle; }
/* Dates et horodatages tiennent sur une seule ligne : repliés, ils cassent
 * l'alignement du tableau et se lisent mal. */
.al-tableau td.al-date { white-space: nowrap; }
.al-tableau tbody tr:hover { background: var(--p-bg); }
.al-tableau tbody tr.choisie { background: var(--p-tint); }
.al-tableau .al-case { width: 38px; }
.al-tableau .al-fin { width: 54px; text-align: right; }

.al-personne { display: flex; align-items: center; gap: 10px; min-width: 0; }
.al-personne b { font-weight: 600; white-space: nowrap; }

.al-pastille-nom {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--p-tint);
    color: var(--p-blue);
    font-size: 10.5px;
    font-weight: 700;
    flex: 0 0 auto;
}

.al-etiquette {
    display: inline-block;
    padding: 3px 9px;
    border-radius: 7px;
    font-size: 11px;
    font-weight: 600;
    background: var(--p-tint);
    color: var(--p-blue);
    white-space: nowrap;
}
.al-etiquette.analyste { background: rgba(138, 92, 214, .14); color: #8a5cd6; }
.al-etiquette.agent { background: rgba(242, 169, 59, .16); color: #b4761a; }

.al-statut { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; white-space: nowrap; }
.al-statut::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.al-statut.actif { color: #2fa36b; }
.al-statut.attente { color: #c08015; }
.al-statut.inactif { color: #d1483c; }

.al-vide { padding: 34px 16px; text-align: center; color: var(--p-muted); font-size: 13px; }

/* --- Nature d'une action, dans le journal d'audit ----------------------- */

.al-action {
    display: inline-block;
    padding: 3px 9px;
    border-radius: 7px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
    background: var(--p-tint);
    color: var(--p-blue);
}
.al-action.creation { background: rgba(47, 163, 107, .14); color: #2fa36b; }
.al-action.modification { background: rgba(242, 169, 59, .16); color: #b4761a; }
.al-action.suppression { background: rgba(209, 72, 60, .13); color: #d1483c; }
.al-action.exportation { background: rgba(138, 92, 214, .14); color: #8a5cd6; }
.al-action.deconnexion { background: rgba(91, 104, 130, .15); color: #5b6882; }

/* --- Période et actions d'en-tête --------------------------------------- */

.al-entete-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.al-periode {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 7px 11px;
    border: 1px solid var(--p-border);
    border-radius: 9px;
    background: var(--p-card);
    font-size: 12px;
    color: var(--p-muted);
}
.al-periode input { border: 0; background: transparent; color: inherit; font: inherit; padding: 0; }

/* --- Pied de tableau ---------------------------------------------------- */

.al-pied {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 12px 16px;
    font-size: 12px;
    color: var(--p-muted);
    flex-wrap: wrap;
}

.al-pages { display: flex; align-items: center; gap: 5px; }
.al-pages button {
    min-width: 30px;
    height: 30px;
    padding: 0 8px;
    border-radius: 8px;
    border: 1px solid var(--p-border);
    background: var(--p-card);
    color: inherit;
    cursor: pointer;
    font-size: 12px;
}
.al-pages button.active { background: var(--p-blue); border-color: var(--p-blue); color: #fff; font-weight: 600; }
.al-pages button[disabled] { opacity: .4; cursor: not-allowed; }

/* --- Panneau de détail --------------------------------------------------- */

.al-panneau {
    position: relative;
    background: var(--p-card);
    border: 1px solid var(--p-border);
    border-radius: 13px;
    box-shadow: var(--p-shadow);
    padding: 20px 18px 18px;
}

.al-panneau-fermer {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 26px;
    height: 26px;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: var(--p-muted);
    cursor: pointer;
    font-size: 15px;
    line-height: 1;
}
.al-panneau-fermer:hover { background: var(--p-bg); }

.al-panneau-tete { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 7px; }
.al-panneau-tete .al-pastille-nom { width: 56px; height: 56px; font-size: 17px; }
.al-panneau-tete b { font-size: 15px; }
.al-panneau-tete small { color: var(--p-muted); font-size: 12px; overflow-wrap: anywhere; }

.al-onglets { display: flex; gap: 2px; margin: 16px 0 14px; border-bottom: 1px solid var(--p-border); }
.al-onglets button {
    flex: 1;
    padding: 9px 4px;
    border: 0;
    background: transparent;
    color: var(--p-muted);
    font-size: 12px;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
}
.al-onglets button.active { color: var(--p-blue); border-bottom-color: var(--p-blue); font-weight: 600; }

.al-champs { display: grid; gap: 13px; }
.al-champ { display: flex; gap: 11px; align-items: flex-start; }
.al-champ svg { color: var(--p-muted); flex: 0 0 auto; margin-top: 2px; }
.al-champ-libelle { font-size: 11px; color: var(--p-muted); }
.al-champ-valeur { font-size: 13px; font-weight: 500; overflow-wrap: anywhere; }

.al-actions { display: grid; gap: 8px; margin-top: 18px; }
.al-actions button {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 12px;
    border-radius: 9px;
    border: 1px solid var(--p-border);
    background: var(--p-card);
    color: inherit;
    font-size: 12.5px;
    cursor: pointer;
    text-align: left;
}
.al-actions button:hover { background: var(--p-bg); }
.al-actions button.danger { color: #d1483c; border-color: rgba(209, 72, 60, .35); }
.al-actions button.danger:hover { background: rgba(209, 72, 60, .08); }

.al-journal { display: grid; gap: 10px; max-height: 320px; overflow: auto; }
.al-journal article { border-left: 2px solid var(--p-border); padding-left: 11px; }
.al-journal b { display: block; font-size: 12.5px; font-weight: 600; }
.al-journal small { color: var(--p-muted); font-size: 11px; }

/* --- Tableur ------------------------------------------------------------ */

/* La barre d'onglets au-dessus du tableau (Données, Qualité, Dashboards,
 * Assistant IA, Corrections, Tableur) reprenait mot pour mot des entrées déjà
 * présentes dans le menu de gauche : deux chemins pour la même chose, et une
 * bande de hauteur perdue sur chaque écran de projet. */
.v25-project-tabs { display: none !important; }

/* L'écran laissait une bande vide de chaque côté, et surtout toute la hauteur
 * sous le tableau. Celui-ci occupe désormais la place disponible : sur des
 * données, chaque ligne visible en plus compte. */
/* Deux marges se cumulaient avant le tableau — 20 px sur le conteneur et
 * 34 px sur la carte — soit plus de 50 px de blanc entre le menu et la
 * première colonne. On les ramène à un filet. */
body[data-page="project"] .content {
    max-width: none !important;
    padding: 12px 10px 14px !important;
}

body[data-page="project"] .v25-sheet { padding: 10px !important; }

/* Près de 300 px séparaient le haut de l'écran de la première ligne : titre
 * surdimensionné, onglets, barre d'outils, barre de formule et en-tête de
 * colonnes empilés. Chaque bande resserrée rend une ligne de données de plus. */
.v25-sheet-head { margin-bottom: 8px !important; }
.v25-sheet-head h1 { font-size: 21px !important; }
.v25-onglets { margin-bottom: 6px; }
.v25-onglets button { padding: 7px 14px; }
/* La barre d'outils revient à la ligne quand la place manque — panneau de
 * détails ouvert, fenêtre étroite. Lui interdire le retour à la ligne faisait
 * déborder son dernier élément hors de la carte, où il passait sous le
 * panneau : le bouton « Détails » devenait inatteignable. */
.v25-toolbar { padding-bottom: 8px !important; flex-wrap: wrap !important; }
.v25-toolbar input[type="search"],
.v25-toolbar .search,
.v25-toolbar [placeholder*="Rechercher"] { min-width: 170px; flex: 1 1 170px; }
.v25-formule { padding: 6px 12px; }

.v25-layout {
    width: 100% !important;
    max-width: none !important;
    position: relative;
    /* Le tableau occupe toute la hauteur de l'écran, comme un tableur : la
     * grille descend jusqu'au pied de page, et le pied de tableau reste
     * toujours visible en bas plutôt que de flotter sous les quelques lignes
     * chargées. */
    min-height: calc(100vh - var(--p-top, 64px) - 130px);
    align-items: stretch;
}

.v25-main { display: flex; flex-direction: column; min-height: 0; }

/* Les colonnes s'étalent sur toute la largeur disponible : sans cela, elles se
 * serraient à gauche et laissaient une bande blanche à droite du tableau. */
.v25-grid { width: 100%; table-layout: auto; }

/* La carte et sa grille s'étirent sur toute la hauteur restante : les lignes
 * commencent en haut, le pied de tableau reste collé en bas. */
body[data-page="project"] .v25-sheet {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}
/* Le prototype fixait une hauteur à la zone de défilement : elle restait de
 * la même taille quelle que soit la place disponible. On la laisse occuper
 * tout ce que la carte lui laisse. */
.v25-grid-scroll {
    flex: 1 1 auto;
    min-height: 0;
    height: auto !important;
    max-height: none !important;
    overflow: auto;
}
body[data-page="project"] .v25-main { flex: 1; min-height: 0; }
.v25-aside { align-self: stretch; overflow: auto; }

/* Le panneau de droite se replie, et le tableau reprend sa place. */
.v25-layout.panneau-replie { grid-template-columns: minmax(0, 1fr) !important; }
.v25-layout.panneau-replie .v25-aside { display: none !important; }

.v25-bascule-panneau {
    display: inline-grid;
    place-items: center;
    width: 34px;
    height: 34px;
    flex: 0 0 auto;
    padding: 0;
    /* Collé au bord droit de la barre d'outils, au-dessus du tableau, sans
     * empiéter sur le champ de recherche voisin. */
    margin-left: 2px;
    border: 1px solid var(--p-border);
    border-radius: 9px;
    background: var(--p-card);
    color: var(--p-ink);
    cursor: pointer;
    transition: background-color .15s ease;
}
.v25-bascule-panneau:hover { background: var(--p-tint); }
.v25-bascule-panneau svg { transition: transform .15s ease; }

/* --- Menu de tri ---------------------------------------------------------- */

.v25-menu-tri {
    position: fixed;
    z-index: 60;
    min-width: 250px;
    max-height: 60vh;
    overflow: auto;
    padding: 10px;
    border: 1px solid var(--p-border);
    border-radius: 11px;
    background: var(--p-card);
    box-shadow: 0 10px 34px rgba(32, 39, 53, .16);
}
.v25-menu-tri p {
    margin: 0 0 8px;
    padding: 0 4px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--p-muted);
}
.v25-menu-ligne {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 4px;
    border-radius: 8px;
}
.v25-menu-ligne:hover { background: var(--p-bg); }
.v25-menu-ligne span { flex: 1; min-width: 0; font-size: 13px; overflow-wrap: anywhere; }
.v25-menu-ligne button {
    width: 28px;
    height: 28px;
    flex: 0 0 auto;
    border: 1px solid var(--p-border);
    border-radius: 7px;
    background: var(--p-card);
    color: var(--p-ink);
    cursor: pointer;
    font-size: 13px;
}
.v25-menu-ligne button:hover { background: var(--p-blue); border-color: var(--p-blue); color: #fff; }

.v25-menu-reinit {
    width: 100%;
    margin-top: 8px;
    padding: 8px;
    border: 1px solid var(--p-border);
    border-radius: 8px;
    background: var(--p-bg);
    color: var(--p-ink);
    font-size: 12.5px;
    cursor: pointer;
}
.v25-menu-reinit:hover { background: var(--p-tint); }
.v25-bascule-panneau:hover { background: var(--p-bg); }
/* Le chevron pointe vers l'endroit où le panneau va aller. */
.v25-bascule-panneau[aria-expanded="true"] svg { transform: rotate(0deg); }
.v25-bascule-panneau[aria-expanded="false"] svg { transform: rotate(180deg); }

/* La croix de suppression collée à chaque titre de colonne encombrait
 * l'en-tête et exposait un geste destructeur au moindre clic de travers.
 * La suppression reste accessible par la barre d'outils. */
.v25-grid th [data-act="v25-delete-col"] { display: none !important; }

/* --- Onglets du tableau -------------------------------------------------- */

.v25-onglets {
    display: flex;
    gap: 4px;
    padding: 0 6px;
    border-bottom: 1px solid var(--p-border);
    margin-bottom: 10px;
}
.v25-onglets button {
    padding: 9px 16px;
    border: 0;
    background: transparent;
    color: var(--p-muted);
    font-size: 13px;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
}
.v25-onglets button.actif { color: var(--p-blue); border-bottom-color: var(--p-blue); font-weight: 600; }
.v25-onglets button:hover:not(.actif) { color: var(--p-ink); }

/* --- Pastilles de statut -------------------------------------------------- */

.v25-statut {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 600;
    white-space: nowrap;
}
.v25-statut::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.v25-statut.valide { background: rgba(47, 163, 107, .14); color: #1f7a4f; }
.v25-statut.attente { background: rgba(242, 169, 59, .18); color: #9a6212; }
.v25-statut.corriger { background: rgba(209, 72, 60, .14); color: #c0372c; }

/* --- Colonne totalisée ---------------------------------------------------- */

/* Les colonnes catégorielles s'affichent en texte simple, comme toutes les
 * autres : seule la colonne Statut garde une pastille, parce qu'elle porte un
 * état de contrôle et non une valeur saisie. Seul l'en-tête de la colonne
 * totalisée est teinté, pour indiquer d'où viennent les totaux du pied.
 */
th.v25-colonne-mesure { background: rgba(82, 120, 242, .08) !important; }

/* Le prototype enfermait les valeurs des colonnes catégorielles dans une
 * pastille verte — la même pour toutes les valeurs, ce qui ne distinguait
 * rien et détonnait au milieu des autres colonnes. Elles s'affichent
 * désormais en texte simple, comme leurs voisines. */
.v25-grid .v25-category {
    display: inline;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: none !important;
    color: inherit !important;
    font: inherit !important;
    letter-spacing: inherit !important;
}
/* --- Pagination du tableau ------------------------------------------------ */

.v25-pages { display: flex; align-items: center; gap: 4px; }
.v25-pages button {
    min-width: 28px;
    height: 28px;
    padding: 0 7px;
    border: 1px solid var(--p-border);
    border-radius: 7px;
    background: var(--p-card);
    color: var(--p-ink);
    font-size: 12px;
    cursor: pointer;
}
.v25-pages button.actif { background: var(--p-blue); border-color: var(--p-blue); color: #fff; font-weight: 600; }
.v25-pages button[disabled] { opacity: .4; cursor: not-allowed; }

.v25-par-page {
    height: 28px;
    padding: 0 8px;
    border: 1px solid var(--p-border);
    border-radius: 7px;
    background: var(--p-card);
    color: var(--p-ink);
    font-size: 12px;
}

/* --- Barre de formule --------------------------------------------------- */

.v25-formule {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    border-top: 1px solid var(--p-border);
    border-bottom: 1px solid var(--p-border);
    background: var(--p-bg);
}

.v25-formule-ref {
    min-width: 62px;
    padding: 5px 9px;
    border: 1px solid var(--p-border);
    border-radius: 7px;
    background: var(--p-card);
    font-size: 12.5px;
    font-weight: 600;
    text-align: center;
}

.v25-formule-fx {
    font-style: italic;
    font-weight: 700;
    font-size: 13px;
    color: var(--p-muted);
    padding: 0 2px;
}

.v25-formule-saisie {
    flex: 1;
    min-width: 0;
    padding: 6px 11px;
    border: 1px solid var(--p-border);
    border-radius: 7px;
    background: var(--p-card);
    color: var(--p-ink);
    font-size: 13px;
}

/* --- Pied de tableau ----------------------------------------------------- */

.v25-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    padding: 11px 14px;
    border-top: 1px solid var(--p-border);
    font-size: 12.5px;
}

.v25-compte { color: var(--p-muted); }

.v25-totaux { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.v25-totaux span {
    padding: 5px 11px;
    border: 1px solid var(--p-border);
    border-radius: 8px;
    background: var(--p-bg);
    font-size: 12.5px;
    white-space: nowrap;
}
.v25-totaux b { font-weight: 600; color: var(--p-muted); margin-right: 5px; }

/* Le contenu des cellules était écrit en bleu pâle sur blanc, en 12 pixels :
 * illisible pour des données qu'on vient justement lire. */
.v25-layout table td,
.v25-layout table th { font-size: 13.5px; }
.v25-layout table td { color: #202735; }
.v25-layout table td input,
.v25-layout table td select,
.v25-layout table td textarea { font-size: 13.5px; color: #202735; }
.v25-layout table th { color: #4a5771; font-weight: 600; }

:root[data-theme="sombre"] .v25-layout table td,
:root[data-theme="sombre"] .v25-layout table td input,
:root[data-theme="sombre"] .v25-layout table td select { color: #f3f6fc; }
:root[data-theme="sombre"] .v25-layout table th { color: #aab8d2; }

/* --- Espace Agent terrain ------------------------------------------------ */

/* L'en-tête de l'espace agent n'offrait aucun chemin de sortie : sans menu
 * latéral, on y restait enfermé. La flèche de retour se place là où on la
 * cherche, avant le nom de l'application. */
.v29-workspace > header { display: flex; align-items: center; gap: 10px; }

.v29-retour {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    flex: 0 0 auto;
    border: 1px solid var(--p-border);
    border-radius: 10px;
    background: var(--p-card);
    color: var(--p-ink);
    cursor: pointer;
    transition: background-color .15s ease;
}
.v29-retour:hover { background: var(--p-tint); }
.v29-retour:focus-visible { outline: 2px solid var(--p-blue); outline-offset: 2px; }

/* --- Mon compte --------------------------------------------------------- */

.al-deux-colonnes {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    align-items: start;
}
.al-deux-colonnes > div { display: grid; gap: 16px; }

.al-bloc { padding: 0; }
.al-bloc-tete {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 15px 18px;
    border-bottom: 1px solid var(--p-border);
}
.al-bloc-tete h3 { display: flex; align-items: center; gap: 9px; margin: 0; font-size: 14px; }
.al-bloc-tete h3 svg { color: var(--p-blue); }
.al-bloc-actions { display: flex; gap: 8px; }
.al-bloc-corps { padding: 16px 18px; display: grid; gap: 14px; }

.al-ligne-champ { display: grid; gap: 5px; }

.al-boite-champ {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border: 1px solid var(--p-border);
    border-radius: 9px;
    background: var(--p-bg);
    font-size: 13px;
    min-height: 40px;
}
.al-boite-champ svg { color: var(--p-muted); flex: 0 0 auto; }
.al-boite-champ input[type="text"],
.al-boite-champ select {
    flex: 1;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    padding: 0;
    min-width: 0;
}
.al-boite-champ span { overflow-wrap: anywhere; }
.al-bascule span { flex: 1; }
.al-bascule input[type="checkbox"] { flex: 0 0 auto; width: 38px; height: 21px; }

.al-definitions { display: grid; grid-template-columns: auto 1fr; gap: 10px 18px; margin: 0; font-size: 13px; }
.al-definitions dt { color: var(--p-muted); font-size: 12px; }
.al-definitions dd { margin: 0; font-weight: 500; text-align: right; overflow-wrap: anywhere; }

.al-rangee {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 12px;
    border: 1px solid var(--p-border);
    border-radius: 10px;
    flex-wrap: wrap;
}
.al-rangee-texte { display: flex; align-items: flex-start; gap: 11px; min-width: 0; flex: 1 1 220px; }
.al-rangee-texte svg { color: var(--p-muted); flex: 0 0 auto; margin-top: 2px; }
.al-rangee b { display: block; font-size: 13px; }
.al-rangee small { color: var(--p-muted); font-size: 11.5px; }

.al-pastille-nom.al-grande { width: 46px; height: 46px; font-size: 15px; }

.al-danger { margin-top: 16px; border-color: rgba(209, 72, 60, .3); }
.al-danger .al-rangee { border-color: rgba(209, 72, 60, .25); }
.al-danger .al-rangee-texte svg { color: #d1483c; }
.p-btn.danger { background: transparent; border: 1px solid rgba(209, 72, 60, .4); color: #d1483c; }
.p-btn.danger:hover { background: rgba(209, 72, 60, .08); }

@media (max-width: 980px) {
    .al-deux-colonnes { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 1180px) {
    .al-chiffres { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .al-colonnes.avec-panneau { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 640px) {
    .al-chiffres { grid-template-columns: minmax(0, 1fr); }
    .al-entete { flex-direction: column; align-items: stretch; }
}

/* ======================================================================
   Tableur — édition des données
   ====================================================================== */

/* Une cellule modifiée et pas encore enregistrée porte un liseré : on voit
   d'un coup d'œil ce qui partira au prochain enregistrement. */
/* Le repère est peint en `box-shadow` et non en `background` : le champ de
   saisie reçoit un fond opaque d'une règle plus spécifique du prototype
   (`input:not([type="checkbox"])…`), qui recouvrait entièrement un fond posé
   sur la cellule. Un `box-shadow` intérieur passe par-dessus, et la teinte
   translucide se pose aussi bien sur un fond clair que sombre. */
.v25-grid td.al-cellule-modifiee,
.v25-grid td.al-cellule-modifiee .v25-cell {
    box-shadow: inset 3px 0 0 #d99400, inset 0 0 0 100px rgba(217, 148, 0, .14);
}
.v25-grid td.al-cellule-modifiee .v25-cell { font-weight: 600; }

/* Une ligne ajoutée n'existe pas encore en base : elle se distingue de celles
   qui y sont déjà, sans quoi on croirait avoir enregistré. */
.v25-grid tr.al-ligne-neuve td,
.v25-grid tr.al-ligne-neuve .v25-cell {
    box-shadow: inset 0 0 0 100px rgba(11, 138, 75, .13);
}
.v25-grid tr.al-ligne-neuve .row-index::after { content: ' ＋'; color: #0b8a4b; }

/* Une colonne calculée ne se saisit pas : elle le montre. */
.v25-grid .v25-cell[readonly] { color: var(--p-muted, #5b6b85); cursor: default; }

/* État d'enregistrement, à la place de la pastille « Enregistré
   automatiquement » du prototype, qui n'enregistrait rien. */
.v25-autosave.al-en-attente { background: #fdf2d8; color: #8a5a00; }

[data-al-enregistrer]:disabled { opacity: .5; }

/* ======================================================================
   Tableur — sélection et mise en forme
   ====================================================================== */

/* Le marquage de la sélection se pose sur la cellule **et** sur son champ de
   saisie. Le champ occupe toute la cellule et son fond est opaque (voir
   `ecran-tableur-forme.js`) : posé sur la seule cellule, le liseré était
   entièrement recouvert et la sélection restait invisible. */

/* Plage de cellules : un liseré, pour ne pas masquer la couleur de fond. */
.v25-grid td.al-plage,
.v25-grid td.al-plage .v25-cell { box-shadow: inset 0 0 0 2px #3977fa; }

/* Ligne ou colonne entière : un voile bleu léger, posé au-dessus de la
   couleur de fond éventuelle sans l'effacer. */
.v25-grid td.al-ligne-choisie,
.v25-grid td.al-colonne-choisie,
.v25-grid td.al-ligne-choisie .v25-cell,
.v25-grid td.al-colonne-choisie .v25-cell { box-shadow: inset 0 0 0 100px rgba(57, 119, 250, .10); }
.v25-grid .row-index.al-ligne-choisie,
.v25-grid th.al-colonne-choisie { background: #dbe8ff; color: #1b4fd1; }
.v25-grid th.al-titre-choisi { box-shadow: inset 0 0 0 2px #3977fa; }
.v25-grid thead th { cursor: pointer; }
.v25-grid tbody .row-index { cursor: pointer; }

/* L'unité s'affiche à côté du champ de saisie, jamais dedans : écrite dans le
   champ, elle repartirait au serveur comme une valeur. */
.v25-grid td.al-avec-unite { position: relative; }
.v25-grid td.al-avec-unite .v25-cell { padding-right: 46px; }
.v25-grid .al-unite {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 11px;
    color: var(--p-muted, #5b6b85);
    pointer-events: none;
}

/* La barre s'insère entre la barre d'outils et la grille : elle pousse le
   tableau vers le bas au lieu de le recouvrir. Un menu flottant masquait les
   premières lignes — celles-là mêmes qu'on vient de sélectionner. */
.al-barre-forme {
    display: flex;
    align-items: center;
    gap: 7px;
    flex-wrap: wrap;
    padding: 8px 12px;
    border-bottom: 1px solid var(--p-line, #dde3ec);
    background: var(--p-tint, #f6f8fc);
}
.al-forme-cible {
    font-size: 12px;
    font-weight: 700;
    color: var(--p-ink, #202735);
    min-width: 126px;
}
.al-forme-separateur {
    width: 1px;
    height: 20px;
    background: var(--p-line, #dde3ec);
}
.al-forme-espace { flex: 1; }
.al-barre-forme button {
    min-width: 28px;
    height: 28px;
    padding: 0 7px;
    font: inherit;
    font-size: 12.5px;
    line-height: 1;
    border: 1px solid var(--p-line, #dde3ec);
    border-radius: 7px;
    background: var(--p-card, #fff);
    color: var(--p-ink, #202735);
    cursor: pointer;
}
.al-barre-forme button:hover { border-color: #8baeff; background: #eef4ff; }
.al-barre-forme button.actif { border-color: #2865f3; background: #e0ebff; color: #1554e9; }

.al-forme-groupe {
    display: flex;
    align-items: center;
    gap: 3px;
    padding: 0 6px;
    border: 1px solid var(--p-line, #dde3ec);
    border-radius: 8px;
    background: var(--p-card, #fff);
    height: 28px;
}
.al-forme-groupe > b { font-size: 11.5px; color: var(--p-muted, #5b6b85); margin-right: 2px; }
.al-barre-forme .al-teinte {
    min-width: 16px;
    width: 16px;
    height: 16px;
    padding: 0;
    border-radius: 4px;
    font-size: 9px;
    color: var(--p-muted, #5b6b85);
}
.al-barre-forme .al-teinte.actif { box-shadow: 0 0 0 2px #2865f3; }
.al-forme-effacer { white-space: nowrap; }
.al-forme-effacer:hover { border-color: rgba(209, 72, 60, .45) !important; color: #d1483c; }

@media (max-width: 1100px) {
    .al-forme-cible { min-width: 0; }
    .al-forme-espace { display: none; }
}

/* Indicateurs d'une colonne sélectionnée, dans le pied du tableau. Ils
   remplacent les totaux généraux : on regarde la colonne qu'on a choisie. */
.v25-bottom { flex-wrap: wrap; gap: 8px; }
.al-chiffres { flex-wrap: wrap; gap: 4px 12px; }
.al-chiffres-titre {
    font-weight: 700;
    color: var(--p-ink, #202735);
    padding-right: 4px;
    border-right: 1px solid var(--p-line, #dde3ec);
    margin-right: 4px;
}
.al-chiffres b { color: var(--p-muted, #5b6b85); font-weight: 600; }

/* Poignée de recopie : le petit carré au coin bas-droit de la sélection,
   posé en coordonnées écran pour chevaucher la bordure de la cellule. */
.al-poignee {
    position: fixed;
    z-index: 900;
    width: 9px;
    height: 9px;
    border: 1px solid #fff;
    border-radius: 2px;
    background: #3977fa;
    cursor: crosshair;
}
body.al-etirement-en-cours { cursor: crosshair; user-select: none; }
body.al-etirement-en-cours .v25-cell { pointer-events: none; }

/* Les cellules que l'étirement va remplir, pendant qu'on tire. */
.v25-grid td.al-etirement,
.v25-grid td.al-etirement .v25-cell {
    box-shadow: inset 0 0 0 1px #3977fa, inset 0 0 0 100px rgba(57, 119, 250, .07);
}

/* Renommer une colonne : la saisie prend la place du titre, à l'identique. */
.al-titre-saisie {
    width: 100%;
    min-width: 90px;
    padding: 3px 6px;
    font: inherit;
    font-size: 12px;
    font-weight: 700;
    color: var(--p-ink, #202735);
    border: 1px solid #2865f3;
    border-radius: 5px;
    background: var(--p-card, #fff);
    outline: none;
}

/* Actions de ligne : seulement quand une ligne entière est sélectionnée. */
.al-forme-lignes { display: flex; gap: 5px; }
.al-forme-lignes.al-masque { display: none; }
.al-barre-forme .al-forme-lignes button:disabled { opacity: .4; cursor: not-allowed; }
.al-barre-forme [data-al-ligne="supprimer"]:hover:not(:disabled) {
    border-color: rgba(209, 72, 60, .45);
    background: rgba(209, 72, 60, .08);
    color: #d1483c;
}

/* La boîte générique du prototype, masquée quand celle du Tableur pose déjà
   la même question (voir `masquerLaBoiteEnDouble`). */
.modal-shade.al-boite-en-double { display: none !important; }

/* ======================================================================
   Tableur — en-tête et mise en page
   ====================================================================== */

/* Les styles du prototype sont déclarés APRÈS cette feuille : à spécificité
   égale, ce sont les siens qui l'emportent. D'où le préfixe `.v25-sheet` sur
   chaque règle de cette section — il suffit à passer devant, sans recourir
   à `!important`. */

/* L'en-tête tenait sur trois niveaux empilés : logo, titre sur deux lignes,
   puis deux pastilles l'une sous l'autre. Tout tient désormais sur une seule
   ligne, et le tableau remonte d'autant. */
.v25-sheet .v25-sheet-head {
    align-items: center;
    gap: 14px;
    margin: 0 0 12px;
}
.v25-sheet .v25-sheet-title { flex: 1 1 auto; min-width: 0; align-items: center; }
/* `:not(.v25-sheet-mark)` n'est pas décoratif : sans lui, cette règle visait
   aussi le carré vert et lui rendait un `display`, juste après la règle qui
   le masque — il restait donc affiché. */
.v25-sheet .v25-sheet-title > div:not(.v25-sheet-mark) {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    flex-wrap: wrap;
}
.v25-sheet .v25-sheet-head h1 {
    font-size: 21px;
    letter-spacing: -.3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 46vw;
}
.v25-sheet .v25-sheet-title .v25-project-tag,
.v25-sheet .v25-sheet-title .v25-autosave { margin-top: 0; }

/* Le carré vert ne porte aucune information : le nom du tableau suffit. */
.v25-sheet .v25-sheet-mark { display: none; }

/* « Importer » passe par l'import du projet, qui vérifie et profile les
   données ; « Nouvelle ligne » fait double emploi avec « Ajouter une ligne »
   de la barre d'outils. Les deux actions existent toujours, elles ne sont
   simplement plus proposées deux fois. */
.v25-sheet .v25-sheet-actions [data-act="v25-import"],
.v25-sheet .v25-sheet-actions [data-act="v25-add-row"] { display: none; }

/* Les onglets Qualité et Analyses IA font doublon avec le menu de gauche. */
.v25-onglets { display: none; }

/* Hauteurs resserrées : chaque bande gagnée fait remonter le tableau. */
.v25-sheet .v25-toolbar { padding: 9px 11px; }
.v25-sheet .v25-formule { padding: 7px 11px; }
.v25-sheet .v25-bottom { padding: 8px 12px; }

/* ----------------------------------------------------------------------
   Zoom du tableau — même mécanisme que celui de la section Données
   ---------------------------------------------------------------------- */

.v25-grid-scroll { --al-zoom: 1; }
.v25-grid-scroll .v25-grid { zoom: var(--al-zoom); transform-origin: top left; }

/* L'apparence vient entièrement de `.v20-dataset-zoom`, la classe du zoom de
   la section Données : les deux réglages sont ainsi identiques, au pixel près.
   On ne corrige ici que ce qui tient à son emplacement — une barre pleine
   largeur là-bas, un élément parmi d'autres dans le pied du tableau ici. */
.v25-bottom .al-zoom {
    padding: 0;
    border: 0;
    background: transparent;
}
/* Dans la barre de Données, l'astuce pousse les commandes vers la droite.
   Dans le pied, elle repousserait la pagination hors de vue. */
.v25-bottom .al-zoom .v20-dataset-zoom__hint { margin-right: 0; }

@media (max-width: 1280px) {
    .v25-bottom .al-zoom .v20-dataset-zoom__hint,
    .v25-bottom .al-zoom input[type="range"] { display: none; }
}
@media (max-width: 900px) {
    .v25-sheet-head h1 { max-width: none; }
}

/* ======================================================================
   Mode sombre — fonds clairs restés en place
   ====================================================================== */

/* Le texte passe en clair avec le thème, mais ces fonds gardaient leur teinte
   du mode clair : l'écriture s'y fondait (contraste mesuré à 1,3 — illisible,
   il en faut 4,5). On leur donne une teinte sombre de la même famille, plutôt
   que de toucher aux couleurs du mode clair, qui sont justes. */
body.dark .v25-project-tag {
    background: rgba(79, 131, 255, .20);
    color: #bcd2ff;
}
body.dark .v25-autosave {
    background: rgba(47, 163, 107, .20);
    color: #7fe0ae;
}
body.dark .v25-autosave.al-en-attente {
    background: rgba(217, 148, 0, .22);
    color: #f3cd72;
}
body.dark .v25-grid tr.al-ligne-neuve .row-index::after { color: #5fd49b; }

/* Croix de fermeture : lisibles, mais trop effacées (contraste 2,2). */
body.dark .v25-close-detail { color: #9fb3d1; }

/* Le bandeau « Générateur de formulaire » répétait en phrase ce que le bouton
   « Nouveau formulaire » de la liste fait déjà, juste au-dessus de celle-ci.
   Les deux boutons déclenchaient la même action ; on garde celui qui surmonte
   ce qu'il crée. */
body .builder-shortcut { display: none; }

/* ======================================================================
   Tableur — choix du tableau et création
   ====================================================================== */

.al-choix-tableau {
    height: 28px;
    max-width: 230px;
    flex: 0 1 auto;
    min-width: 0;
    padding: 0 8px;
    font: inherit;
    font-size: 12.5px;
    color: var(--p-ink, #202735);
    border: 1px solid var(--p-line, #dde3ec);
    border-radius: 8px;
    background: var(--p-card, #fff);
    cursor: pointer;
}
.al-choix-tableau:hover { border-color: #8baeff; }

/* Fenêtre de création : un seul écran, deux informations. */
.al-fenetre-fond {
    position: fixed;
    inset: 0;
    z-index: 1300;
    display: grid;
    place-items: center;
    padding: 18px;
    background: rgba(11, 27, 60, .45);
}
.al-fenetre {
    width: min(430px, 100%);
    padding: 22px;
    border-radius: 15px;
    background: var(--p-card, #fff);
    color: var(--p-ink, #202735);
    box-shadow: 0 22px 70px rgba(0, 0, 0, .33);
}
.al-fenetre h3 { margin: 0 0 16px; font-size: 17px; }
.al-fenetre label {
    display: block;
    margin: 0 0 6px;
    font-size: 12px;
    font-weight: 600;
    color: var(--p-muted, #5b6b85);
}
.al-fenetre input[type="text"],
.al-fenetre select {
    width: 100%;
    height: 38px;
    margin-bottom: 14px;
    padding: 0 11px;
    font: inherit;
    font-size: 13.5px;
    color: var(--p-ink, #202735);
    border: 1px solid var(--p-line, #dde3ec);
    border-radius: 9px;
    background: var(--p-card, #fff);
    outline: none;
}
.al-fenetre input[type="text"]:focus,
.al-fenetre select:focus { border-color: #4f83ff; box-shadow: 0 0 0 3px rgba(79, 131, 255, .18); }
.al-choix-emplacement { display: flex; gap: 8px; margin-bottom: 12px; }
.al-radio {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 7px;
    margin: 0;
    padding: 9px 11px;
    font-size: 12.5px;
    font-weight: 500;
    color: var(--p-ink, #202735);
    border: 1px solid var(--p-line, #dde3ec);
    border-radius: 9px;
    cursor: pointer;
}
.al-radio:has(input:checked) { border-color: #2865f3; background: rgba(79, 131, 255, .08); }
.al-radio input { width: auto; height: auto; margin: 0; accent-color: #2865f3; }
.al-fenetre-note {
    margin: 0 0 18px;
    font-size: 12px;
    line-height: 1.5;
    color: var(--p-muted, #5b6b85);
}
.al-fenetre-actions { display: flex; justify-content: flex-end; gap: 9px; }
/* `display: flex` ci-dessus l'emporte sur le `display: none` natif de
   l'attribut `hidden` — même spécificité, et la règle la plus tardive gagne.
   Repéré à l'écran : un bouton « Annuler » restait visible sous le second
   bloc d'actions une fois la connexion établie, l'attribut `hidden` posé en
   JavaScript n'ayant alors aucun effet. */
.al-fenetre-actions[hidden] { display: none; }
.al-fenetre-actions button {
    height: 36px;
    padding: 0 15px;
    font: inherit;
    font-size: 13px;
    border: 1px solid var(--p-line, #dde3ec);
    border-radius: 9px;
    background: transparent;
    color: inherit;
    cursor: pointer;
}
.al-fenetre-actions .al-principal {
    border-color: #2865f3;
    background: #2865f3;
    color: #fff;
    font-weight: 600;
}
.al-fenetre-actions button:disabled { opacity: .55; cursor: default; }

/* ======================================================================
   Importer un fichier
   ====================================================================== */

.al-fenetre-large { width: min(560px, 100%); }

.al-depot {
    display: grid;
    gap: 4px;
    place-items: center;
    padding: 22px 16px;
    margin-bottom: 14px;
    text-align: center;
    border: 1.5px dashed var(--p-line, #dde3ec);
    border-radius: 11px;
    cursor: pointer;
    transition: border-color .16s, background .16s;
}
.al-depot:hover,
.al-depot:focus-visible,
.al-depot.al-survol { border-color: #2865f3; background: rgba(79, 131, 255, .07); }
.al-depot b { font-size: 13.5px; }
.al-depot span { font-size: 12px; color: var(--p-muted, #5b6b85); }

.al-feuilles { margin-bottom: 14px; }
.al-feuille {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 4px 9px;
    margin: 0 0 6px;
    padding: 9px 11px;
    font-weight: 500;
    border: 1px solid var(--p-line, #dde3ec);
    border-radius: 9px;
    cursor: pointer;
}
.al-feuille:has(input:checked) { border-color: #2865f3; background: rgba(79, 131, 255, .06); }
.al-feuille input { width: auto; height: auto; margin: 0; accent-color: #2865f3; }
.al-feuille-nom { font-size: 13px; color: var(--p-ink, #202735); }
.al-feuille-taille { font-size: 11.5px; color: var(--p-muted, #5b6b85); white-space: nowrap; }
/* L'avertissement occupe la largeur sous le nom : il se lit, il ne se devine pas. */
.al-feuille-note {
    grid-column: 2 / -1;
    font-size: 11.5px;
    font-weight: 400;
    color: #8a5a00;
}
.al-feuille-bloquee { opacity: .55; cursor: not-allowed; }

.al-fenetre-erreur {
    margin: 0 0 14px;
    padding: 10px 12px;
    font-size: 12.5px;
    border-radius: 9px;
    background: rgba(209, 72, 60, .09);
    color: #b2382d;
}
body.dark .al-feuille-note { color: #f3cd72; }
body.dark .al-fenetre-erreur { background: rgba(209, 72, 60, .18); color: #ffb4a8; }
