/* Assistant Minier (GMO 2.35.0, cahier des charges section 4.2 ; lot 7) : fenêtre flottante, panneau ancré dans le dock,
   volets (Aide, Conversation, Résultats, Mes conversations), aperçu de l'envoi, onglet de la barre d'état. Jetons de
   app.css seulement ; aucun style en ligne (CSP) : place et taille de la fenêtre posées par le CSSOM (--am-x, --am-y,
   --am-l, --am-h). La page ne défile jamais : la fenêtre est en position absolue dans le cadre, bornée par lui, et seuls
   les volets défilent (.am-defile). */

/* ---------- Fenêtre flottante ---------- */
.am-fenetre {
  --am-x: 0px; --am-y: 0px; --am-l: 440px; --am-h: 560px;
  position: absolute; left: var(--am-x); top: var(--am-y); z-index: 50; width: var(--am-l); height: var(--am-h);
  max-width: 100%; max-height: 100%; min-width: 0; min-height: 0; display: flex; flex-direction: column; overflow: hidden;
  background: var(--bg-1); color: var(--ink); border: 1px solid var(--line-fort); border-radius: var(--r3); box-shadow: var(--ombre);
}
.am-fenetre[data-etat="agrandie"] { border-radius: 0; box-shadow: none; }
.am-titre {
  flex: none; height: var(--h-tete); display: flex; align-items: center; gap: var(--e3); padding: 0 var(--e1) 0 var(--e4);
  background: var(--bg-2); border-bottom: 1px solid var(--line); color: var(--ink-2); cursor: move; touch-action: none;
  -webkit-user-select: none; user-select: none;
}
.am-fenetre[data-etat="agrandie"] .am-titre { cursor: default; }
.am-glisse .am-titre { cursor: grabbing; }
.am-glisse, .am-redim { -webkit-user-select: none; user-select: none; }
.am-nom { min-width: 0; overflow: hidden; color: var(--ink); font-size: var(--fs-m); font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.am-titre .b-mini { cursor: pointer; }
.am-titre .b-mini[aria-pressed="true"] { background: var(--bg-3); color: var(--ink); }

/* Quatre bords et quatre coins de redimensionnement (souris, doigt, stylet) ; aucun quand la fenêtre est agrandie. */
.am-bord { position: absolute; z-index: 3; touch-action: none; }
.am-bord[data-bord="n"] { top: -3px; left: 10px; right: 10px; height: 6px; cursor: ns-resize; }
.am-bord[data-bord="s"] { bottom: -3px; left: 10px; right: 10px; height: 6px; cursor: ns-resize; }
.am-bord[data-bord="e"] { right: -3px; top: 10px; bottom: 10px; width: 6px; cursor: ew-resize; }
.am-bord[data-bord="w"] { left: -3px; top: 10px; bottom: 10px; width: 6px; cursor: ew-resize; }
.am-bord[data-bord="ne"] { top: -3px; right: -3px; width: 13px; height: 13px; cursor: nesw-resize; }
.am-bord[data-bord="nw"] { top: -3px; left: -3px; width: 13px; height: 13px; cursor: nwse-resize; }
.am-bord[data-bord="se"] { bottom: -3px; right: -3px; width: 13px; height: 13px; cursor: nwse-resize; }
.am-bord[data-bord="sw"] { bottom: -3px; left: -3px; width: 13px; height: 13px; cursor: nesw-resize; }
.am-bord:hover, .am-redim .am-bord { background: color-mix(in srgb, var(--focus) 35%, transparent); }
.am-fenetre[data-etat="agrandie"] .am-bord { display: none; }
.am-hote { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; }

/* ---------- Panneau ancré dans le dock ---------- */
.dock-corps[data-panneau="assistant"] { overflow: hidden; display: flex; flex-direction: column; }
.am-panneau { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.am-barre { flex: none; min-height: 28px; display: flex; align-items: center; gap: var(--e2); padding: 0 var(--e2) 0 var(--e4); background: var(--bg-1); border-bottom: 1px solid var(--line); }
.am-barre .btn[aria-pressed="true"] { box-shadow: none; }
/* « Agrandir » : le dock couvre toute la zone de travail (explorateur, écran et dock) ; l'écran reste monté dessous. */
.cadre[data-assistant="agrandi"] .travail > .dock-droit { position: absolute; inset: 0; z-index: 20; width: auto; box-shadow: none; }
.cadre[data-assistant="agrandi"] .dock-poignee { display: none; }

/* ---------- Contenu : onglets des volets ---------- */
.am-contenu { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; }
/* 2.35.0, lot 14 (relecture R3, constat 8) : les onglets passent à la ligne dans un panneau ou une fenêtre étroite (aucun
   onglet caché sans barre de défilement visible). */
.am-onglets { flex: none; display: flex; flex-wrap: wrap; align-items: stretch; min-height: var(--h-onglets); background: var(--bg-1); border-bottom: 1px solid var(--line); overflow: hidden; }
.am-onglets [role="tab"] { flex: none; height: var(--h-onglets); padding: 0 var(--e5); border: 0; border-right: 1px solid var(--line); background: transparent; color: var(--ink-2); font-size: var(--fs-m); white-space: nowrap; }
.am-onglets [role="tab"]:hover { background: var(--bg-3); color: var(--ink); }
.am-onglets [role="tab"][aria-selected="true"] { background: var(--grid-bg); color: var(--ink); font-weight: 600; box-shadow: inset 0 -2px 0 var(--accent); }
.am-volet { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.am-defile { flex: 1; min-height: 0; overflow: auto; display: grid; align-content: start; gap: var(--e4); padding: var(--e4) var(--e5); scrollbar-width: thin; scrollbar-color: var(--line-fort) transparent; }
.am-v-tete { display: flex; align-items: center; gap: var(--e3); min-width: 0; }
.am-v-tete h3 { font-size: var(--fs-m); }

/* ---------- Volet Aide ---------- */
.am-recherche { flex: none; display: flex; align-items: center; gap: var(--e3); padding: var(--e4) var(--e5); border-bottom: 1px solid var(--line); }
.am-recherche .champ { flex: 1; }
.am-passages { list-style: none; display: grid; gap: var(--e4); }
.am-passage { display: grid; gap: var(--e2); padding: var(--e3) var(--e4); border: 1px solid var(--line); border-radius: var(--r2); background: var(--grid-bg); }
.am-p-titre { font-size: var(--fs-m); }
.am-p-extrait { color: var(--ink); line-height: 1.45; overflow-wrap: anywhere; }
.am-p-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--e3); }
.am-p-formules { color: var(--ink-2); font-size: var(--fs-s); }
.am-p-formules code, .am-apercu code { font-family: var(--mono); font-size: var(--fs-s); }

/* ---------- Volet Conversation ---------- */
.am-inactif strong { display: block; margin-bottom: var(--e2); }
.am-inactif p + p { margin-top: var(--e2); }
.am-journal { display: grid; gap: var(--e4); }
.am-msg { display: grid; gap: var(--e2); padding: var(--e3) var(--e4); border: 1px solid var(--line); border-radius: var(--r2); background: var(--grid-bg); }
.am-msg-u { margin-left: 15%; background: var(--choisi-panneau); }
.am-msg-qui { color: var(--ink-2); font-size: var(--fs-s); font-weight: 600; }
.am-msg-texte { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.45; }
.am-msg[aria-busy="true"] .am-msg-qui::after { content: " …"; }
/* 2.35.3 (D2) : réponse de l'Assistant Minier mise en forme (sous-ensemble de Markdown rendu sûr, rendu_reponse.js). */
.am-md { white-space: normal; display: grid; gap: var(--e3); }
.am-md > * { margin: 0; }
.am-md ul, .am-md ol { display: grid; gap: var(--e1); padding-left: calc(var(--e5) + var(--e4)); }
.am-md li.am-md-sous { margin-left: var(--e5); }
.am-md-titre { font-size: var(--fs-m); font-weight: 600; }
.am-md code { padding: 0 var(--e1); border-radius: var(--r1); background: var(--bg-2); font-family: var(--mono); font-size: var(--fs-s); }
.am-md-code { padding: var(--e3) var(--e4); border: 1px solid var(--line); border-radius: var(--r1); background: var(--bg-2); overflow: auto; white-space: pre; }
.am-md-code code { padding: 0; background: none; }
.am-md-trait { border: 0; border-top: 1px solid var(--line); }
.am-md-table { max-width: 100%; overflow: auto; }
.am-md-table table { border-collapse: collapse; font-size: var(--fs-s); }
.am-md-table th, .am-md-table td { padding: var(--e1) var(--e3); border: 1px solid var(--grid-line); text-align: left; vertical-align: top; }
.am-md-table th { background: var(--bg-2); font-weight: 600; }
.am-lien { text-decoration: underline; cursor: pointer; overflow-wrap: anywhere; }
.am-etapes { margin: 0; padding-left: var(--e5); color: var(--ink-2); font-size: var(--fs-s); }
.am-etapes:empty { display: none; }
.am-msg-resultat, .am-msg-question { display: flex; flex-wrap: wrap; align-items: center; gap: var(--e3); }
.am-msg-question > p { flex-basis: 100%; }
.am-saisie { flex: none; display: grid; gap: var(--e2); padding: var(--e4) var(--e5); border-top: 1px solid var(--line); color: var(--ink-2); font-size: var(--fs-s); }
.am-saisie textarea.champ { height: auto; min-height: 52px; max-height: 160px; padding: var(--e2) 5px; resize: vertical; color: var(--ink); font-size: var(--fs-m); line-height: 1.4; }
.am-saisie-actions { display: flex; align-items: center; gap: var(--e3); }
/* 2.35.3 (D1) : choix du type de question quand la compagnie est en mode données (groupe radio), figé par la conversation. */
.am-modes { display: flex; flex-wrap: wrap; align-items: center; gap: var(--e2); }
.am-modes [role="radio"][aria-checked="true"] { background: var(--choisi-panneau); color: var(--ink); font-weight: 600; box-shadow: inset 0 -2px 0 var(--accent); }
.am-modes [role="radio"]:disabled { cursor: default; }
.am-modes-note { flex-basis: 100%; }
.am-avertissement { flex: none; padding: var(--e2) var(--e5); border-top: 1px solid var(--line); background: var(--bg-2); color: var(--ink-2); font-size: var(--fs-xs); line-height: 1.4; }

/* Aperçu « Ce qui sera envoyé » (à chaque envoi). */
.am-zone-apercu { display: block; }
.am-apercu { display: grid; gap: var(--e3); padding: var(--e4); border: 1px solid var(--warn); border-radius: var(--r2); background: var(--warn-bg); color: var(--ink); }
.am-apercu-tete { display: flex; align-items: center; gap: var(--e3); }
.am-apercu-tete h3 { font-size: var(--fs-m); }
.am-apercu-texte { padding: var(--e3) var(--e4); border: 1px solid var(--line); border-radius: var(--r1); background: var(--grid-bg); font-family: var(--mono); font-size: var(--fs-s); white-space: pre-wrap; overflow-wrap: anywhere; }
.am-a-verifier { background: color-mix(in srgb, var(--warn) 45%, transparent); outline: 1px dashed var(--warn); }
.am-apercu-details { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: var(--e1) var(--e4); font-size: var(--fs-s); }
.am-apercu-details dt { color: var(--ink-2); }
.am-apercu-details dd { margin: 0; overflow-wrap: anywhere; }
.am-apercu-actions { display: flex; gap: var(--e3); }

/* ---------- Volet Résultats ---------- */
.am-resultat { display: grid; gap: var(--e3); padding: var(--e4); border: 1px solid var(--line); border-radius: var(--r2); background: var(--grid-bg); min-width: 0; }
.am-r-tete { display: flex; align-items: center; gap: var(--e3); min-width: 0; }
.am-r-tete h3 { flex: 1; min-width: 0; font-size: var(--fs-m); overflow-wrap: anywhere; }
.am-table { max-height: 320px; overflow: auto; border: 1px solid var(--grid-line); }
.am-graphique { position: relative; height: 280px; min-width: 0; }
.am-valeurs { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: var(--e1) var(--e4); }
.am-valeurs dt { color: var(--ink-2); }
.am-valeurs dd { margin: 0; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.am-sources summary { cursor: pointer; color: var(--ink-2); font-size: var(--fs-s); }
.am-sources ul { margin: var(--e2) 0 0; padding-left: var(--e5); font-size: var(--fs-s); }
.am-r-exports { display: flex; flex-wrap: wrap; gap: var(--e2); }

/* ---------- Mes conversations ---------- */
.am-conversations { list-style: none; display: grid; gap: var(--e2); }
.am-conv { width: 100%; display: grid; gap: 1px; padding: var(--e3) var(--e4); border: 1px solid var(--line); border-radius: var(--r2); background: var(--grid-bg); color: var(--ink); text-align: left; }
.am-conv:hover { background: var(--survol); }

/* ---------- Onglet de la barre d'état (fenêtre réduite) ---------- */
.be-assistant { padding: 0 var(--e2) !important; }
.am-onglet-etat { height: 18px; display: inline-flex; align-items: center; gap: var(--e2); padding: 0 var(--e3); border: 1px solid var(--line-fort); border-radius: var(--r1); background: var(--bg-1); color: var(--ink); font-size: var(--fs-s); font-weight: 600; white-space: nowrap; box-shadow: inset 0 -2px 0 var(--accent); }
.am-onglet-etat:hover { background: var(--bg-3); }

/* ---------- Petits écrans, présentation, impression ---------- */
@media (max-width: 759px) {
  .am-fenetre { border-radius: 0; }
  .am-msg-u { margin-left: 0; }
}
.cadre[data-presentation="oui"] .am-fenetre { display: none; }
@media print { .am-fenetre, .am-onglet-etat { display: none !important; } }
