/* ═══════════════════════════════════════════════════════════════════════════════════════════════
   DTISoft — Objectifs de chiffre d'affaires (Dashboard → Objectifs, chantier « Pilotage », lot 5, 2026-10-27)
   Préfixe obj- (écran, fiche .obj-overlay, réglages, import, reconduction, tuile de la fiche tiers). S'appuie sur
   css/pilotage.css (pil-, stat-, kpi-, chart-) sans le modifier.
   §7.16 : défilement INTERNE (.pil-contenu, .obj-corps) ; §7.41 : [hidden] repassé en (0,2,0) dans chaque conteneur.
   Empilement (z-index en ligne) : fiche / fenêtres de l'écran 7800 (SOUS le détail des statistiques 7900 et les fiches
   document 8000 / tiers 9600 qu'on ouvre depuis elles) ; message de refus 10600 (comme la confirmation).
   ═══════════════════════════════════════════════════════════════════════════════════════════════ */
.obj-wrap [hidden], .obj-overlay [hidden], .obj-fen-overlay [hidden], .obj-msg-overlay [hidden] { display: none; }

/* ── Écran : barre et liste ── */
.obj-barre .stat-input { max-width: 170px; }
.obj-barre .obj-recherche { max-width: 220px; }
.obj-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-left: auto; }
.obj-resume { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; margin-bottom: 10px; font-size: 12.5px; color: var(--gray-700); }
.obj-puce { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 12px; background: var(--white);
            border: 1px solid var(--pil-bord); cursor: pointer; font: inherit; font-size: 12px; color: var(--gray-700); }
.obj-puce--active { outline: 2px solid var(--blue-light); outline-offset: 0; }
.obj-table-zone { background: var(--white); border: 1px solid var(--pil-bord); border-radius: 8px; overflow: auto; max-height: calc(100vh - 290px); min-height: 120px; }
.obj-table { table-layout: auto; }
.obj-table thead th { position: sticky; top: 0; z-index: 1; cursor: pointer; user-select: none; }
.obj-table thead th[aria-sort="ascending"]::after { content: " \25B2"; font-size: 9px; }
.obj-table thead th[aria-sort="descending"]::after { content: " \25BC"; font-size: 9px; }
.obj-table th.stat-num, .obj-table td.stat-num { width: 1%; }
.obj-table tbody tr { cursor: pointer; }
.obj-table tbody tr.obj-inactif td { color: var(--gray-400); }
.obj-cible { width: 100%; max-width: 0; min-width: 180px; }
.obj-cible-lib { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; white-space: normal; overflow-wrap: anywhere; line-height: 1.3; }
.obj-cible-code { font-size: 10.5px; color: var(--gray-400); }
.obj-type { display: inline-block; font-size: 10px; padding: 0 6px; border-radius: 8px; background: var(--gray-100); color: var(--gray-500); margin-right: 4px; vertical-align: 1px; }
.obj-negatif { color: #b91c1c; }
.obj-positif { color: #15803d; }

/* Badge de statut */
.obj-badge { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 11px; font-weight: 700; white-space: nowrap; }
.obj-badge--RETARD { background: var(--pil-baisse-fond); color: var(--pil-baisse); }
.obj-badge--PALIER { background: #fef3c7; color: #92400e; }
.obj-badge--OK { background: var(--pil-hausse-fond); color: var(--pil-hausse); }
.obj-badge--AVENIR { background: var(--gray-100); color: var(--gray-500); }

/* Barre d'atteinte : remplissage = réalisé / annuel ; repère = attendu / annuel */
.obj-barre-att { position: relative; width: 120px; height: 8px; background: var(--gray-100); border-radius: 4px; overflow: visible; margin-top: 3px; }
.obj-barre-att > .obj-rempli { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 4px; background: var(--chart-1); opacity: .75; max-width: 100%; }
.obj-barre-att > .obj-rempli.obj-rempli--RETARD { background: #dc2626; }
.obj-barre-att > .obj-rempli.obj-rempli--PALIER { background: #d97706; }
.obj-barre-att > .obj-repere { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--gray-700); }
.obj-pct { font-variant-numeric: tabular-nums; }

/* ── Fiche et fenêtres de l'écran ── */
.obj-overlay, .obj-fen-overlay {
    position: fixed; inset: 0; z-index: 7800; background: rgba(15, 23, 42, .45);
    display: flex; align-items: center; justify-content: center; padding: 16px;
}
.obj-panel {
    display: flex; flex-direction: column; width: min(1080px, 100%); max-height: 92vh; min-height: 0;
    background: var(--white); border-radius: 8px; box-shadow: 0 20px 60px rgba(0, 0, 0, .35); overflow: hidden;
}
.obj-panel--etroit { width: min(720px, 100%); }
.obj-tete { display: flex; align-items: center; gap: 10px; padding: 10px 16px; background: #1e3a8a; color: #fff; }
.obj-tete-titre { flex: 1 1 auto; min-width: 0; font-size: 15px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.obj-tete .stat-btn--icone { color: #fff; background: transparent; border-color: rgba(255, 255, 255, .4); }
.obj-onglets { display: flex; gap: 2px; padding: 6px 16px 0; border-bottom: 1px solid var(--pil-bord); background: var(--gray-50); }
.obj-onglet { padding: 6px 14px; border: 1px solid transparent; border-bottom: none; border-radius: 6px 6px 0 0; background: transparent;
              font: inherit; font-size: 12.5px; color: var(--gray-500); cursor: pointer; }
.obj-onglet[aria-selected="true"] { background: var(--white); border-color: var(--pil-bord); color: var(--blue-dark); font-weight: 700; margin-bottom: -1px; }
.obj-corps { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 12px 16px; }
.obj-pied { display: flex; align-items: center; gap: 8px; padding: 10px 16px; border-top: 1px solid var(--pil-bord); }
.obj-pied-info { flex: 1 1 auto; min-width: 0; font-size: 11.5px; color: var(--gray-500); }
.obj-grille { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px 14px; margin-bottom: 12px; }
.obj-champ { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.obj-champ > span { font-size: 11px; font-weight: 600; color: var(--gray-500); }
.obj-champ .stat-input { max-width: none; width: 100%; }
.obj-champ--large { grid-column: 1 / -1; }
.obj-champ textarea.stat-input { height: 56px; resize: vertical; }
.obj-montant { text-align: right; font-variant-numeric: tabular-nums; }
.obj-section { margin: 4px 0 14px; padding-top: 10px; border-top: 1px solid var(--gray-100); }
.obj-section-titre { font-size: 13px; font-weight: 700; color: var(--blue-dark); margin-bottom: 6px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.obj-radios { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12.5px; color: var(--gray-700); }
.obj-radios label { display: inline-flex; align-items: center; gap: 5px; cursor: pointer; }
.obj-cible-zone { position: relative; }
.obj-cible-choix { display: flex; align-items: center; gap: 8px; min-height: 28px; font-size: 12.5px; }
.obj-cible-choix strong { color: var(--blue-dark); }
.obj-resultats { position: absolute; z-index: 5; left: 0; right: 0; top: 100%; max-height: 240px; overflow: auto; background: var(--white);
                 border: 1px solid var(--gray-300); border-radius: 4px; box-shadow: var(--shadow-md); }
.obj-resultat { display: block; width: 100%; text-align: left; padding: 5px 8px; border: none; background: none; font: inherit; font-size: 12.5px; cursor: pointer; }
.obj-resultat:hover, .obj-resultat:focus { background: var(--blue-pale); outline: none; }
.obj-resultat small { color: var(--gray-400); margin-left: 6px; }
.obj-mois { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px 8px; margin-top: 8px; }
.obj-mois label { display: flex; flex-direction: column; gap: 2px; font-size: 11px; color: var(--gray-500); }
.obj-mois .stat-input { max-width: none; width: 100%; text-align: right; }
.obj-somme { font-size: 12px; margin-top: 6px; color: var(--gray-700); }
.obj-somme--ko { color: #b91c1c; font-weight: 600; }
.obj-note { font-size: 11.5px; color: var(--gray-500); margin-top: 4px; line-height: 1.4; }
.obj-apercu { min-height: 170px; }
.obj-paliers td .stat-input { max-width: none; width: 100%; }
.obj-paliers td { padding: 3px 4px; }
.obj-tuiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 170px), 1fr)); gap: 10px; margin-bottom: 12px; }
.obj-tuiles .kpi-valeur { font-size: 18px; }
.obj-alerte { padding: 8px 10px; border-radius: 6px; font-size: 12.5px; margin-bottom: 10px; background: #fffbeb; border: 1px solid #fde68a; color: #92400e; }
.obj-alerte--info { background: #eff6ff; border-color: #bfdbfe; color: var(--blue-dark); }
.obj-liste-fonctions { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 4px 12px; font-size: 12.5px; }
.obj-liste-fonctions label { display: flex; align-items: center; gap: 6px; }
.obj-rapport { max-height: 340px; overflow: auto; border: 1px solid var(--pil-bord); border-radius: 6px; margin-top: 8px; }
.obj-rapport:empty { display: none; }
.obj-res--erreur { color: #b91c1c; font-weight: 600; }
.obj-res--creation, .obj-res--maj { color: #15803d; font-weight: 600; }

/* Message de refus / d'information (invariant 69 : jamais une boîte native) */
.obj-msg-overlay { position: fixed; inset: 0; z-index: 10600; background: rgba(15, 23, 42, .45); display: flex; align-items: center; justify-content: center; padding: 16px; }

/* ── Tuile « Objectif <année> » de la fiche tiers (classes td-stat de la fiche + obj-tuile) ── */
.td-stat.obj-tuile { border-left: 3px solid var(--pil-ok); cursor: default; }
.td-stat.obj-tuile--RETARD { border-left-color: #dc2626; }
.td-stat.obj-tuile--PALIER { border-left-color: #d97706; }
.td-stat.obj-tuile--AVENIR { border-left-color: var(--gray-300); }

@media (max-width: 760px) {
    .obj-actions { margin-left: 0; }
    .obj-mois { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .obj-overlay, .obj-fen-overlay { padding: 0; }
    .obj-panel { max-height: 100vh; height: 100%; border-radius: 0; }
}
@media print {
    .obj-actions, .obj-overlay, .obj-fen-overlay { display: none !important; }
    .obj-table-zone { max-height: none; overflow: visible; }
}
