/* ====================================================================== projets d'analyse */

.pile-courte { display: flex; flex-direction: column; gap: .5rem; margin-bottom: .8rem; }
.pile-courte label { margin: 0; }
.pile-courte p:empty, #an-message:empty { display: none; }
.an-projets li { margin-bottom: .2rem; }
.an-atouts { list-style: none; padding: 0; margin: 1rem 0 0; display: grid; gap: .75rem;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 210px), 1fr)); }
.an-atouts li { border: 1px solid var(--trait); border-top: 3px solid var(--accent); border-radius: var(--rayon);
  padding: .8rem .9rem; display: flex; flex-direction: column; gap: .25rem; }
.an-atouts li:nth-child(2) { border-top-color: var(--valide); }
.an-atouts li:nth-child(3) { border-top-color: var(--ocre); }
.an-atouts span { color: var(--discret); font-size: .9rem; }

.an-projet { display: flex; flex-direction: column; gap: .6rem; min-width: 0; }
.an-projet .retour-liste { display: none; }
.an-tete { display: flex; flex-wrap: wrap; gap: .6rem 1rem; justify-content: space-between; align-items: flex-start; }
.an-tete h2 { margin: 0; font-size: 1.3rem; overflow-wrap: anywhere; }
.an-tete p { margin: .2rem 0 0; }
.an-onglets { overflow-x: auto; margin-bottom: 0; }
.an-onglets button { white-space: nowrap; }
.an-panneau h3 { font-size: 1rem; margin: 1.2rem 0 .5rem; }
.an-panneau h3:first-child { margin-top: .3rem; }
.an-panneau h4 { font-size: .9rem; margin: 1rem 0 .4rem; color: var(--discret); }
.an-deux { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); gap: 0 1.5rem; }
.an-depot { display: flex; flex-wrap: wrap; gap: .5rem; align-items: flex-end; padding: .8rem;
  border: 1px dashed color-mix(in srgb, var(--accent) 35%, var(--trait)); border-radius: var(--rayon); background: var(--fond); }
.an-depot label { flex: 1 1 220px; margin: 0; }
.an-liste li { justify-content: space-between; align-items: center; }
.an-element { display: flex; flex-direction: column; min-width: 0; }
.an-element strong { overflow-wrap: anywhere; }
.an-actions { display: flex; gap: .3rem; flex-wrap: wrap; }
code.an-nom-sql, .an-puce { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: .8rem;
  background: var(--accent-clair); color: var(--accent); border-radius: 4px; padding: .05rem .35rem; align-self: flex-start; }
.an-puce { display: inline-block; border: 1px solid transparent; margin: 0 .3rem .3rem 0; font-family: inherit; font-size: .85rem; }
button.an-puce { cursor: pointer; font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; }
button.an-puce:hover { border-color: var(--accent); }

/* tableaux */
.an-grille td, .an-grille th { text-align: left !important; }
.an-grille td.vide, .tableau td.vide { color: var(--discret); }
.an-profil td, .an-profil th { text-align: left !important; white-space: normal; vertical-align: top; }
.an-profil td:first-child { font-weight: 600; }
.an-resume { color: var(--discret); font-size: .85rem; min-width: 18rem; }
.an-pages { align-items: center; margin-top: .5rem; }
.an-resultat { margin-top: .8rem; display: flex; flex-direction: column; gap: .6rem; }
.an-resultat .boutons { align-items: center; justify-content: space-between; }

.an-agreger { display: flex; flex-wrap: wrap; gap: .6rem; align-items: flex-end; }
.an-agreger label { margin: 0; min-width: 9rem; }
.an-filtre { display: flex; flex-wrap: wrap; gap: .4rem; border: 1px solid var(--trait); border-radius: var(--rayon);
  padding: .35rem .6rem .55rem; margin: 0; }
.an-filtre legend { font-size: .8rem; color: var(--discret); padding: 0 .3rem; }
.an-filtre input { width: 9rem; }

/* barres horizontales */
ol.an-barres { list-style: none; padding: 0; margin: .4rem 0; display: flex; flex-direction: column; gap: .2rem; }
.an-barres li { display: grid; grid-template-columns: minmax(6rem, 34%) 1fr auto; gap: .6rem; align-items: center; font-size: .9rem; }
.an-barre-nom { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.an-barre-nom.cliquable { cursor: pointer; }
.an-barre-nom.cliquable:hover { color: var(--accent); text-decoration: underline; }
.an-barre-piste { height: .7rem; background: var(--fond); border-radius: 3px; overflow: hidden; }
.an-barre { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.an-barre-val { font-variant-numeric: tabular-nums; color: var(--discret); min-width: 3ch; text-align: right; }

/* SQL */
.an-code { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: .9rem; margin-bottom: .5rem; }
.an-noms-sql { margin: .2rem 0 .6rem; }

/* parole */
.an-options { margin-bottom: .4rem; }
.an-chiffres { font-weight: 600; margin: .2rem 0 .6rem; }
.an-kwic { list-style: none; padding: 0; margin: 0; max-height: 28rem; overflow-y: auto; }
.an-kwic li { padding: .45rem 0; border-bottom: 1px solid var(--trait); }
.an-kwic-ligne { line-height: 1.5; }
.an-kwic .avant { color: var(--discret); }
.an-kwic mark { background: var(--accent-clair); color: var(--accent); font-weight: 600; border-radius: 3px; padding: 0 .15rem; }
.an-specificites { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); gap: .7rem; }
.an-specifique { border: 1px solid var(--trait); border-radius: var(--rayon); padding: .6rem .75rem; }
.an-specifique p { margin: .4rem 0 0; }
.an-exclus { margin-top: 1rem; }
.an-exclus summary { cursor: pointer; font-weight: 600; }

/* thèmes et codage */
.an-themes { display: grid; grid-template-columns: minmax(240px, 1fr) minmax(0, 2fr); gap: 0 1.5rem; }
.an-themes #an-form-code { flex-wrap: wrap; }
.an-themes #an-form-code .large-champ { flex: 1 1 100%; min-width: 0; }
@media (max-width: 900px) { .an-themes { grid-template-columns: 1fr; } }
.an-themes input[type="color"] { width: 2.6rem; height: 2.3rem; padding: .15rem; }
.an-codes { list-style: none; padding: 0; margin: .5rem 0; }
.an-codes li { display: flex; flex-wrap: wrap; align-items: center; gap: .1rem .45rem; padding: .4rem 0; border-bottom: 1px solid var(--trait); }
.an-code-nom { flex: 1 1 8rem; min-width: 0; font-weight: 600; }
.an-code-nb { color: var(--discret); font-size: .85rem; font-variant-numeric: tabular-nums; }
.an-code-actions { flex-basis: 100%; padding-left: 1.25rem; display: flex; gap: .6rem; }
.an-pastille { display: inline-block; width: .8rem; height: .8rem; border-radius: 50%; flex: none; }
.an-barre-codage { position: sticky; top: 0; z-index: 2; background: var(--carte); padding: .3rem 0; }
.an-lecteur { max-height: 34rem; overflow-y: auto; border: 1px solid var(--trait); border-radius: var(--rayon); padding: .2rem .8rem; }
.an-seg { padding: .5rem 0; border-bottom: 1px solid var(--trait); }
.an-seg:last-child { border-bottom: none; }
.an-seg-tete { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.an-seg-texte { margin: .15rem 0 0; line-height: 1.6; cursor: text; border-radius: 4px; padding: .1rem .25rem; }
.an-seg-texte:hover { background: var(--fond); }
.an-etiquette { --c: var(--accent); font-size: .75rem; font-weight: 600; color: var(--c); border: 1px solid var(--c);
  border-radius: 999px; padding: 0 .45rem; white-space: nowrap; }
.an-extraits { list-style: none; padding: 0; margin: .4rem 0; display: flex; flex-direction: column; gap: .5rem; }
.an-extraits li { --c: var(--accent); border-left: 3px solid var(--c); padding: .3rem 0 .3rem .8rem; }
.an-extraits blockquote { margin: 0 0 .2rem; font-style: italic; }
.an-note { margin: .2rem 0 0; }
.an-matrice th { max-width: 10rem; overflow: hidden; text-overflow: ellipsis; }
.an-matrice td:first-child { text-align: left; white-space: nowrap; }
.an-matrice td.an-case { text-align: center !important; font-weight: 600;
  background: color-mix(in srgb, var(--c) calc(var(--a) * 100%), transparent); }
.an-matrice td.vide { text-align: center !important; }

/* inscription et compte : choix des services */
.choix-services { border: 1px solid var(--trait); border-radius: var(--rayon); padding: .5rem .8rem .2rem; margin: 0 0 .6rem; }
.choix-services legend { font-size: .9rem; font-weight: 600; padding: 0 .3rem; }
.choix-services label.case, #form-services label.case { margin-bottom: .3rem; }
.choix-services p { margin: .2rem 0 .4rem; }
.pub-services { color: var(--discret); max-width: 62ch; border-left: 3px solid var(--valide); padding-left: .8rem; }

@media (max-width: 820px) {
  #vue-analyses.doc-ouvert > aside { display: none; }
  #vue-analyses.doc-ouvert .an-projet .retour-liste { display: inline-block; align-self: flex-start; }
  #vue-analyses:not(.doc-ouvert) #an-accueil { display: none; }
  .an-barres li { grid-template-columns: minmax(5rem, 40%) 1fr auto; }
}

@media print {
  #vue-analyses aside, .an-onglets, .an-tete .boutons { display: none !important; }
}

/* offre d'analyse (gratuite ou pass) */
.an-offre { margin: -.2rem 0 .9rem; padding: .6rem .7rem; border-radius: var(--rayon); background: var(--fond); }
.an-offre p { margin: 0 0 .35rem; }
.an-jauge { height: 5px; background: var(--trait); border-radius: 3px; overflow: hidden; }
.an-jauge span { display: block; height: 100%; background: var(--valide); }
.an-jauge span.haute { background: var(--ocre); }
.an-offre .lien-bouton { margin-top: .35rem; padding: 0; }
.achat-groupe { grid-column: 1 / -1; font-weight: 700; color: var(--titre); margin-top: .4rem; }
.achat-pack.pass { border-top: 3px solid var(--valide); }
.achat-pack.pass strong { font-size: 1.25rem; }
.achat-pack.actuel { border-color: var(--valide); background: color-mix(in srgb, var(--valide) 6%, var(--carte)); }

/* tableaux de bord dans l'application */
.an-tdb-barre { display: flex; flex-wrap: wrap; gap: .5rem .6rem; align-items: flex-end; margin-bottom: .4rem; }
.an-tdb-barre label { margin: 0; min-width: 14rem; }
.an-tdb-outils { display: flex; flex-wrap: wrap; gap: .4rem; margin-left: auto; }
.an-tdb-nom { margin: .6rem 0 0 !important; font-size: 1.1rem !important; }
.an-tdb-aide { background: var(--fond); border-radius: var(--rayon); padding: .6rem .8rem; margin: .4rem 0 1rem; }
.an-tdb-aide p { margin: 0 0 .4rem; font-size: .88rem; color: var(--discret); }
.an-tdb-aide .boutons { align-items: center; }
.an-titre-action { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: .2rem .8rem; }
.an-titre-action .lien-bouton { font-weight: 600; }
.an-resultat-tete { justify-content: space-between; align-items: center; }
.dialogue-tdb { width: min(46rem, 94vw); }
.dialogue-tdb .ligne-form label { flex: 1 1 12rem; }
.tdb-apercu { border: 1px solid var(--trait); border-radius: var(--rayon); padding: .8rem; margin: .4rem 0; max-height: 22rem; overflow: auto; }
@media print {
  body.impression-tdb .entete, body.impression-tdb .pied-legal, body.impression-tdb #vue-analyses > aside,
  body.impression-tdb .an-tete .boutons, body.impression-tdb #an-onglets, body.impression-tdb .an-tdb-barre,
  body.impression-tdb #an-message, body.impression-tdb .retour-liste, body.impression-tdb .an-tdb-aide,
  body.impression-tdb .an-panneau:not([data-panneau="tdb"]) { display: none !important; }
  body.impression-tdb .mise-en-page { display: block; padding: 0; }
  body.impression-tdb .carte { border: 0; box-shadow: none; padding: 0; }
}

/* préparation sans code */
.an-prep { border: 1px solid var(--trait); border-radius: 12px; padding: .9rem 1rem; margin-top: .6rem; }
.an-prep-tete h3 { margin: 0 0 .2rem !important; }
.an-prep-tete p { margin: 0 0 .6rem; }
.an-prep-grille { display: grid; grid-template-columns: minmax(250px, 1fr) minmax(0, 2fr); gap: 1rem 1.4rem; }
@media (max-width: 980px) { .an-prep-grille { grid-template-columns: 1fr; } }
.an-prep h4 { margin: .2rem 0 .4rem; font-size: .9rem; color: var(--discret); }
.an-prep-etapes { margin: 0 0 .6rem; padding-left: 1.3rem; }
.an-prep-etapes li { padding: .25rem 0; border-bottom: 1px solid var(--trait); }
.an-prep-etapes li span { overflow-wrap: anywhere; }
.an-prep-etapes li button { margin-left: .4rem; }
.an-prep-form { background: var(--fond); border-radius: var(--rayon); padding: .7rem; display: flex; flex-direction: column; gap: .4rem; }
.an-prep-form label { margin: 0; }
.an-prep-champs { display: flex; flex-direction: column; gap: .4rem; }
.an-prep-champs [hidden] { display: none !important; }
.an-prep-cases { border: 1px solid var(--trait); border-radius: var(--rayon); padding: .3rem .6rem; margin: 0; max-height: 12rem; overflow: auto; }
.an-prep-cases legend { font-size: .82rem; color: var(--discret); }
.an-prep-cases label { margin: .1rem 0; }
.an-prep-apercu { max-height: 26rem; overflow: auto; border: 1px solid var(--trait); border-radius: var(--rayon); }
.an-prep-apercu th small { display: block; font-weight: 400; color: var(--discret); font-size: .72rem; }
.an-prep-apercu th { position: sticky; top: 0; background: var(--carte); }
.an-prep-pied { display: flex; flex-wrap: wrap; gap: .6rem 1rem; align-items: flex-end; justify-content: space-between; margin-top: .9rem; }
.an-prep-pied label { margin: 0; flex: 1 1 18rem; }
#an-table-origine { margin: .1rem 0 .6rem; }

/* espaces d'organisation */
#an-projet.lecture-seule .an-ecriture, #an-projet:not(.proprio) .an-proprio,
#an-projet.lecture-seule #an-prep { display: none !important; }
.an-groupe { cursor: default !important; padding: .7rem .2rem .2rem !important; font-size: .74rem; font-weight: 700;
  letter-spacing: .06em; text-transform: uppercase; color: var(--discret); background: none !important; border: 0 !important; }
.an-espaces-bouton { width: 100%; margin-top: .8rem; }
.an-espace-badge { margin: .15rem 0 0; font-size: .85rem; color: var(--accent); font-weight: 600; }
.an-espace-badge .discret { font-weight: 400; }
.an-deplacer { display: flex; flex-wrap: wrap; gap: .5rem; align-items: flex-end; padding: .7rem; margin-bottom: .8rem;
  border: 1px dashed color-mix(in srgb, var(--accent) 35%, var(--trait)); border-radius: var(--rayon); }
.an-deplacer label { margin: 0; flex: 1 1 18rem; }
.dialogue-espaces { width: min(44rem, 94vw); }
.es-tete { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .4rem; margin-top: .6rem; }
.es-tete h3 { margin: 0; }
.es-membres td { text-align: left !important; vertical-align: middle; white-space: normal; }
.es-membres td:last-child { text-align: right !important; }
#dlg-espaces [hidden], #an-deplacer-zone[hidden] { display: none !important; }

/* assistant IA */
.an-assistant { background: var(--fond-doux, #f4f6fa); border-radius: 10px; padding: .8rem 1rem; margin-bottom: 1rem; }
.an-assistant label { font-weight: 600; display: block; margin-bottom: .4rem; }
.an-assistant-ligne { display: flex; gap: .5rem; }
.an-assistant-ligne input { flex: 1; min-width: 0; }
.an-assistant p { margin: .5rem 0 0; }
.an-ia-reponse { border-left: 3px solid var(--accent, #1f6fd1); padding: .1rem 0 .1rem .8rem; margin: 0 0 .8rem; }
.an-ia-explication { margin: .2rem 0; font-weight: 500; }
.an-assistant-inactif { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.an-assistant-inactif p { margin: 0; flex: 1; }
button.lien { background: none; border: 0; padding: 0; color: var(--accent, #1f6fd1); cursor: pointer; font: inherit; text-decoration: underline; }
.an-ia-sources { margin: .3rem 0; color: var(--texte-doux, #4a5568); }
.an-ia-graphique { margin: .6rem 0 .2rem; max-width: 760px; }
.iap-tables { display: grid; gap: .4rem; max-height: 50vh; overflow: auto; margin: .4rem 0; }
.iap-table { border: 1px solid var(--bordure, #dde3ea); border-radius: 8px; padding: .4rem .7rem; }
.iap-table summary { cursor: pointer; }
.iap-table summary label { display: inline; }
.iap-colonnes { display: flex; flex-wrap: wrap; gap: .2rem 1rem; padding: .5rem 0 .2rem 1.4rem; }
#dlg-ia-projet { max-width: 640px; }
.an-requetes { display: flex; align-items: end; gap: .5rem; flex-wrap: wrap; margin-bottom: .5rem; }
.an-requetes label { flex: 0 1 320px; }
.an-journal-zone { margin-top: 1.6rem; border-top: 1px solid var(--bordure, #dde3ea); padding-top: .8rem; }
.an-journal-zone h3 { margin: 0 0 .3rem; font-size: 1rem; }
.an-journal td.nowrap { white-space: nowrap; }
.an-journal-objet { max-width: 520px; font-size: .85rem; color: var(--texte-doux, #4a5568); }
.assistant-controle { margin: .4rem 0 1rem; }
.assistant-controle table td:first-child { white-space: nowrap; }
.ctrl-ok { color: #2b8a61; font-weight: 600; }
.ctrl-ko { color: #c0392b; font-weight: 600; }
/* connexions de données */
.an-sous-titre { margin: 1.4rem 0 .2rem; }
#an-connexions { margin: .4rem 0 .6rem; }
.cx-etat { font-size: .75rem; font-weight: 600; border-radius: 999px; padding: .05rem .5rem; margin-left: .3rem; vertical-align: middle; }
.cx-ok { background: #e3f4ec; color: #1e6b4a; }
.cx-erreur { background: #fbe9e7; color: #a5301f; }
.cx-en_cours, .cx-nouveau { background: #eef1f5; color: #4a5568; }
.dialogue-connexion { width: min(720px, 96vw); }
#form-source [hidden] { display: none !important; }
#cx-apercu { max-height: 240px; margin-top: .5rem; }
#cx-apercu table { font-size: .8rem; }
/* catalogue et fiches */
.an-fiche { display: flex; gap: 1rem; align-items: flex-start; justify-content: space-between; background: var(--fond-doux, #f4f6fa); border-radius: 10px; padding: .6rem .9rem; margin: .6rem 0; }
.an-fiche p { margin: .15rem 0; }
.an-col-desc { font-weight: 400; max-width: 260px; }
.fiche-colonnes { display: grid; gap: .4rem; max-height: 40vh; overflow: auto; }
.fiche-colonnes label { display: grid; grid-template-columns: minmax(140px, 35%) 1fr; gap: .5rem; align-items: center; }
.ct-liste { max-height: 55vh; overflow: auto; margin-top: .6rem; }
.ct-element { display: flex; flex-direction: column; align-items: flex-start; gap: .15rem; width: 100%; text-align: left; background: none; border: 0; padding: .5rem .3rem; cursor: pointer; font: inherit; color: inherit; }
.ct-element:hover { background: var(--fond-doux, #f4f6fa); }
.ct-element strong { font-size: 1rem; }
.ct-desc { color: var(--texte, #1a202c); }
#an-catalogue-bouton { margin-bottom: .5rem; }
/* données personnelles */
.dp-badge { display: inline-block; margin-left: .4rem; font-size: .7rem; font-weight: 600; color: #7a4a00; background: #fdf1dc; border-radius: 999px; padding: 0 .45rem; vertical-align: middle; }
.dp-note { color: #7a4a00; }
.fiche-colonnes.avec-perso label { grid-template-columns: minmax(130px, 28%) 1fr minmax(150px, 30%); }
.fiche-conservation { margin-top: .8rem; }
#form-fiche-table [hidden] { display: none !important; }
#dlg-fiche #fiche-colonnes > label { display: grid; grid-template-columns: minmax(140px, 32%) 1fr; gap: .5rem; align-items: center; text-align: left; margin: 0; }
#dlg-fiche #fiche-colonnes.avec-perso > label { grid-template-columns: minmax(130px, 28%) 1fr minmax(170px, 32%); }
#dlg-fiche #fiche-colonnes > label > span { display: block; }
#dlg-fiche { width: min(760px, 96vw); }
/* modèles */
.ml-liste { display: grid; grid-template-columns: minmax(0, 1fr); gap: .8rem; margin: .6rem 0 1rem; }
.ml-carte { border: 1px solid var(--bordure, #dde3ea); border-radius: 10px; padding: .7rem .9rem; min-width: 0; }
.ml-tete { display: flex; justify-content: space-between; gap: 1rem; align-items: flex-start; flex-wrap: wrap; }
.ml-carte p { margin: .35rem 0; }
.ml-graphique { max-width: 820px; margin-top: .4rem; }
.ml-nouveau summary { cursor: pointer; font-weight: 600; margin: .4rem 0; }
.ml-cases { display: flex; flex-wrap: wrap; gap: .2rem 1rem; margin-bottom: .5rem; }
#form-modele [hidden] { display: none !important; }
#an-onglets.segmente button { padding-left: .5rem; padding-right: .5rem; }
.an-guide-lien { display: block; text-align: center; font-size: .9rem; margin-top: .5rem; }

/* Cohérence : listes déroulantes jamais plus larges que leur cadre */
.an-depot select, .an-depot input[type="file"] { max-width: 100%; width: 100%; box-sizing: border-box; }
.an-tdb-gestion { display: flex; gap: .2rem 1rem; flex-basis: 100%; justify-content: flex-end; }
.an-tdb-gestion .danger { color: var(--danger, #c62828); }
