/* ═══════════════════════════════════════════════════════════════════════════
   EXPLORATEUR 3D (Distribution Canada → Documents → Catalogue de pièces → R10) — la machine en 3D
   à gauche, le catalogue détaillé à droite (en dessous sur téléphone). Monté par
   wwwroot/js/explorateur-3d.js (et sa géométrie, modeles3d/<clé>.js) dans la page du modèle. La SCÈNE garde un fond clair dans les
   deux thèmes, légèrement assombri en sombre : une mini-pelle bleue se lit mal sur un fond noir.
   La sélection est ROUGE (--x3d-choix) : ni l'orange d'un moteur Kubota, ni le vert et jaune
   d'un concurrent.
   ═══════════════════════════════════════════════════════════════════════════ */
.x3d {
    --x3d-scene-a: #f7f9fc; --x3d-scene-b: #d9e2ee; --x3d-grille: #a9b8cc;
    --x3d-choix: #d3202b; --x3d-choix-doux: rgba(211, 32, 43, 0.13);
    display: flex; flex-direction: column; gap: 10px; margin: 8px 0 18px;
}
[data-theme="dark"] .x3d {
    --x3d-scene-a: #1b2433; --x3d-scene-b: #0b111b; --x3d-grille: #2a3a52;
    --x3d-choix: #ff5a62; --x3d-choix-doux: rgba(255, 90, 98, 0.2);
}
/* L'attribut hidden doit gagner contre les display des pièces (loupe, bulle, réglages…) : sans
   cette règle, la loupe masquée couvrirait la page et mangerait les clics. */
.x3d [hidden] { display: none !important; }
.x3d-barre { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; }
.x3d-recherche { flex: 1 1 320px; display: flex; align-items: center; gap: 8px; min-width: 0; padding: 0 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-secondary); color: var(--text-muted); }
.x3d-recherche:focus-within { border-color: var(--accent); }
.x3d-recherche input { flex: 1; min-width: 0; border: 0; background: transparent; color: var(--text-primary); font: inherit; font-size: 15px; padding: 9px 0; outline: none; }
.x3d-stats { font-size: 12px; color: var(--text-secondary); font-variant-numeric: tabular-nums; }
.x3d-source { font-size: 12px; padding: 3px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); }
.x3d-source.est-copie { background: rgba(217, 119, 6, 0.14); color: #b45309; font-weight: 600; }
[data-theme="dark"] .x3d-source.est-copie { color: #fbbf24; }
.x3d-corps { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);   /* 60 % la machine, 40 % la liste et les sections */ gap: 12px; height: min(78vh, 820px); min-height: 520px; }
.x3d-scene { position: relative; min-width: 0; min-height: 0; border-radius: var(--radius-md); overflow: hidden; touch-action: none; border: 1px solid var(--border);
    background: radial-gradient(120% 95% at 45% 25%, var(--x3d-scene-a), var(--x3d-scene-b)); }
.x3d-scene canvas { display: block; width: 100%; height: 100%; }
.x3d-chargement { position: absolute; inset: 0; display: grid; place-items: center; padding: 24px; text-align: center; color: var(--text-secondary); font-weight: 600; }
.x3d-legende, .x3d-asmbar { position: absolute; top: 12px; left: 12px; right: 12px; display: flex; flex-wrap: wrap; gap: 6px; pointer-events: none; }
.x3d-legende > *, .x3d-asmbar > * { pointer-events: auto; }
.x3d-pastille { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px 0 5px; border-radius: 14px; border: 1px solid var(--border); background: color-mix(in srgb, var(--bg-secondary) 86%, transparent); cursor: pointer; font: inherit; font-size: 12px; color: var(--text-primary); }
.x3d-point { width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 10px; color: #fff; }
.x3d-pastille-nom { display: none; }
.x3d-pastille:hover .x3d-pastille-nom, .x3d-pastille[aria-pressed="true"] .x3d-pastille-nom { display: inline; }
.x3d-pastille[aria-pressed="true"] { border-color: var(--x3d-choix); box-shadow: 0 0 0 1px var(--x3d-choix) inset; }
.x3d-asmlabel { display: grid; gap: 1px; padding: 6px 12px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: color-mix(in srgb, var(--bg-secondary) 90%, transparent); font-size: 12px; min-width: 0; }
.x3d-asmlabel b { font-weight: 600; overflow-wrap: anywhere; }
.x3d-asmlabel span { color: var(--text-secondary); }
.x3d-outils { position: absolute; left: 12px; bottom: 12px; right: 12px; display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; pointer-events: none; }
.x3d-outil { pointer-events: auto; display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 12px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: color-mix(in srgb, var(--bg-secondary) 92%, transparent); color: var(--text-primary); cursor: pointer; font: inherit; font-size: 13px; font-weight: 500; }
.x3d-outil[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.x3d-outil input[type=range] { width: 110px; accent-color: var(--accent); }
label.x3d-outil { cursor: default; }
.x3d-pose { position: absolute; left: 12px; bottom: 56px; width: 270px; max-width: calc(100% - 24px); padding: 12px 14px; border-radius: var(--radius-md); border: 1px solid var(--border); background: var(--bg-secondary); box-shadow: var(--shadow-md); display: grid; gap: 8px; }
.x3d-pose h3 { margin: 0; font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text-secondary); }
.x3d-pose label { display: grid; grid-template-columns: 100px 1fr; align-items: center; gap: 8px; font-size: 12px; color: var(--text-secondary); }
.x3d-pose input { width: 100%; accent-color: var(--accent); }
.x3d-pose-boutons { display: flex; gap: 6px; }
.x3d-pose-boutons button { flex: 1; height: 28px; border-radius: 8px; border: 1px solid var(--border); background: var(--bg-tertiary); color: var(--text-primary); cursor: pointer; font: inherit; font-size: 12px; }
.x3d-aide { position: absolute; right: 14px; bottom: 60px; font-size: 11px; color: var(--text-secondary); text-align: right; pointer-events: none; }
.x3d-bulle { position: absolute; z-index: 3; pointer-events: none; padding: 6px 9px; border-radius: 8px; background: #0d1b3d; color: #fff; font-size: 12px; white-space: nowrap; transform: translate(12px, 12px); }
.x3d-bulle span { opacity: .72; }
.x3d-panneau { min-width: 0; min-height: 0; display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--bg-secondary); overflow: hidden; }
.x3d-fil { display: flex; flex-wrap: wrap; gap: 2px; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--border); font-size: 12px; color: var(--text-secondary); }
.x3d-fil button { border: 0; background: none; padding: 2px 5px; border-radius: 6px; cursor: pointer; color: var(--accent); font: inherit; font-weight: 500; }
.x3d-fil button:hover { background: var(--accent-soft); }
.x3d-fil-sep { opacity: .5; }
.x3d-fil-ici { color: var(--text-primary); font-weight: 600; padding: 2px 5px; }
.x3d-contenu { flex: 1; min-height: 0; overflow-y: auto; padding: 16px; display: grid; align-content: start; gap: 14px; }
.x3d-contenu h2 { margin: 2px 0 0; font-size: 22px; font-weight: 700; line-height: 1.15; letter-spacing: -.02em; text-wrap: balance; }
.x3d-code { color: var(--accent); margin-right: 6px; }
.x3d-surtitre { margin: 0 0 4px; font-size: 11px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: var(--text-secondary); }
.x3d-lede { margin: 0; color: var(--text-secondary); }
.x3d-petit, .x3d-note-asm { margin: 0; font-size: 12px; color: var(--text-secondary); }
.x3d-liste { display: grid; gap: 2px; margin: 0; padding: 0; list-style: none; }
.x3d-item, .x3d-resultat { width: 100%; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: center; text-align: left; padding: 8px 10px; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--text-primary); cursor: pointer; font: inherit; }
.x3d-resultat { grid-template-columns: 26px minmax(0, 1fr); align-items: start; }
.x3d-item:hover, .x3d-item:focus-visible, .x3d-resultat:hover, .x3d-resultat:focus-visible { background: var(--bg-tertiary); }
.x3d-item-k, .x3d-mono { font-family: 'JetBrains Mono', ui-monospace, Menlo, Consolas, monospace; font-size: 12px; color: var(--text-secondary); }
.x3d-item-k { min-width: 38px; }
.x3d-item-t { min-width: 0; overflow-wrap: anywhere; font-weight: 500; }
.x3d-item-t small { display: block; font-size: 12px; font-weight: 400; color: var(--text-secondary); }
.x3d-item-n { font-size: 12px; color: var(--text-secondary); white-space: nowrap; font-variant-numeric: tabular-nums; }
.x3d-sysdot { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 13px; }
.x3d-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.x3d-tag { font-size: 11px; font-weight: 500; padding: 1px 7px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); }
.x3d-zones { display: flex; flex-wrap: wrap; gap: 6px; }
.x3d-zones button { border: 1px solid var(--border); background: var(--bg-tertiary); color: var(--text-primary); border-radius: 8px; padding: 5px 9px; cursor: pointer; font: inherit; font-size: 12px; }
.x3d-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.x3d-actions a, .x3d-actions button { text-decoration: none; }
/* Groupe ouvert avec sa vue éclatée : 45 % la machine, 55 % le panneau, et le dessin officiel
   prend toute la largeur du panneau (sans la marge intérieure) pour se lire sans la loupe. */
.x3d-corps.avec-dessin { grid-template-columns: minmax(0, 9fr) minmax(0, 11fr); }
.x3d-corps.avec-dessin .x3d-figure { margin: 0 -10px; }
.x3d-figure { margin: 0; border: 1px solid var(--border); border-radius: var(--radius-md); background: #fff; overflow: hidden; }
.x3d-figure img { display: block; width: 100%; height: auto; cursor: zoom-in; }
.x3d-figure figcaption { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 8px; padding: 6px 10px; font-size: 11px; color: #6b7084; border-top: 1px solid #e6e8ef; background: #f7f8fb; }
.x3d-tableau { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-md); }
.x3d-tableau table { width: 100%; border-collapse: collapse; font-size: 13px; }
.x3d-tableau th { position: sticky; top: 0; background: var(--bg-tertiary); text-align: left; font-size: 11px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--text-secondary); padding: 8px 7px; border-bottom: 1px solid var(--border); }
.x3d-tableau td { padding: 6px 7px; border-bottom: 1px solid var(--border); vertical-align: top; }
.x3d-tableau tr:last-child td { border-bottom: 0; }
.x3d-tableau tr[data-row] { cursor: pointer; }
.x3d-tableau tr[data-row]:hover td { background: var(--bg-tertiary); }
.x3d-tableau tr.est-choisie td, .x3d-tableau tr.est-choisie:hover td { background: var(--x3d-choix-doux); }
.x3d-tableau tr.est-choisie td.x3d-nom { box-shadow: inset 3px 0 0 var(--x3d-choix); }
.x3d-ref { font-family: 'JetBrains Mono', ui-monospace, Menlo, Consolas, monospace; font-size: 12px; color: var(--text-secondary); }
.x3d-q { text-align: right; font-variant-numeric: tabular-nums; }
.x3d-nom { min-width: 120px; overflow-wrap: anywhere; }
.x3d-inv { border: 0; background: none; padding: 1px 3px; border-radius: 4px; cursor: copy; white-space: nowrap; color: var(--text-primary); font-family: 'JetBrains Mono', ui-monospace, Menlo, Consolas, monospace; font-size: 11.5px; }
.x3d-inv:hover { background: var(--accent-soft); }
.x3d-boutique { font-size: 12px; font-weight: 500; color: var(--accent); white-space: nowrap; }
.x3d mark { background: var(--x3d-choix-doux); color: inherit; border-radius: 2px; }
.x3d-note { display: grid; gap: 6px; padding-top: 12px; border-top: 1px solid var(--border); font-size: 12px; color: var(--text-secondary); }
.x3d-note p { margin: 0; }
.x3d-loupe { position: fixed; inset: 0; z-index: 2000; display: grid; grid-template-rows: auto 1fr; background: rgba(5, 12, 30, 0.86); }
.x3d-loupe header { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 16px; color: #fff; }
.x3d-loupe header span { display: flex; gap: 8px; }
.x3d-loupe header button { height: 32px; padding: 0 12px; border-radius: 8px; border: 1px solid rgba(255, 255, 255, 0.3); background: transparent; color: #fff; cursor: pointer; font: inherit; }
.x3d-loupe-defile { overflow: auto; display: grid; place-items: center; padding: 0 16px 16px; }
.x3d-loupe img { max-width: 100%; max-height: 100%; border-radius: 8px; background: #fff; }
.x3d-loupe.est-agrandie img { max-width: none; max-height: none; width: 1800px; }
.x3d-toast { position: fixed; left: 50%; bottom: 24px; z-index: 2001; transform: translateX(-50%); padding: 8px 14px; border-radius: 10px; background: #0d1b3d; color: #fff; font-size: 13px; }
@media (max-width: 980px) {
    .x3d-corps, .x3d-corps.avec-dessin { grid-template-columns: minmax(0, 1fr); grid-template-rows: 62vh auto; height: auto; }
    .x3d-contenu { overflow: visible; }
    .x3d-aide { display: none; }
    .x3d-outil { height: 32px; padding: 0 10px; font-size: 12px; }
    .x3d-outil input[type=range] { width: 76px; }
}

/* ============================================================
   SIGNALEMENTS — le bouton « Signaler » de la barre, ses deux formulaires, « Mes signalements »
   et la console. Voir docs/signalements.md. Le menu du bouton vit DANS l'entête, qui réécrit
   les jetons de texte en blanc pour sa sous-arborescence : il porte donc ses propres couleurs.
   ============================================================ */
