/* @portee: carriere */
/* v4 — agent 8 : assistant d'import, filtres, statistiques du tableau de bord. Classes préfixées imp8- / f8- / d8-. */

/* ---------------------------------------------------------------- Filtres */
.f8-span-all { grid-column: 1 / -1; }
.f8-span-all .label .subtle { font-weight: 500; }
th[data-sort] { cursor: pointer; user-select: none; white-space: nowrap; }
th[data-sort]:hover { color: var(--text); }
th[data-sort] .ph { font-size: .85em; opacity: .45; margin-left: .15rem; vertical-align: -1px; }
th[data-sort]:hover .ph { opacity: .8; }
.f8-th { display: inline-flex; align-items: center; gap: .1rem; }
th[data-sort].is-sorted .ph { opacity: 1; color: var(--brand-ink); }

/* ---------------------------------------------------------------- Assistant d'import */
.imp8-modal { height: min(760px, calc(100dvh - 32px)); overflow: hidden; }
.imp8, .imp8-body, .imp8-step, .imp8-fill, .imp8-scroll, .imp8-top { min-width: 0; }
.imp8-stepper .stepper-item { min-width: 0; }
.imp8-stepper .stepper-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.imp8 .notice > span { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.imp8 { display: flex; flex-direction: column; min-height: 0; flex: 1 1 auto; }
.imp8-top { display: flex; align-items: center; gap: 1rem; padding: .85rem 1.3rem; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.imp8-stepper { flex: 1 1 420px; min-width: 0; }
.imp8-switch { display: inline-flex; gap: 2px; padding: 3px; border-radius: var(--r-pill); background: var(--bg-sunken); border: 1px solid var(--line); margin-left: auto; }
.imp8-switch button { border: 0; background: none; color: var(--text-2); font: inherit; font-size: .8rem; font-weight: 650; display: inline-flex; gap: .35rem; align-items: center; padding: .35rem .75rem; border-radius: var(--r-pill); cursor: pointer; }
.imp8-switch button.is-active { background: var(--bg-elev); color: var(--text); box-shadow: var(--shadow-sm, 0 1px 2px rgba(0,0,0,.08)); }
.imp8-body { display: flex; flex-direction: column; min-height: 0; flex: 1 1 auto; }
.imp8-step { min-height: 0; }
.imp8-fill { display: flex; flex-direction: column; gap: .75rem; min-height: 0; flex: 1 1 auto; }
.imp8-scroll { flex: 1 1 auto; min-height: 0; overflow: auto; border: 1px solid var(--line); border-radius: var(--r); background: var(--bg-elev); }
.imp8-scroll .table { margin: 0; }
.imp8-scroll .table thead th { position: sticky; top: 0; z-index: 1; background: var(--bg-sunken); }
.imp8-hero { display: flex; gap: 1rem; align-items: center; padding: 1rem 1.1rem; border-radius: var(--r); background: var(--brand-soft); border: 1px solid var(--brand-line); flex-wrap: wrap; }
.imp8-hero .icon-box { background: var(--bg-elev); }
.imp8-help { padding: .9rem 1rem; border-radius: var(--r); background: var(--bg-sunken); border: 1px solid var(--line); line-height: 1.55; }
.imp8-tips { list-style: none; margin: 0; padding: 0; display: grid; gap: .45rem; color: var(--text-2); }
.imp8-tips li { display: flex; gap: .5rem; align-items: flex-start; }
.imp8-tips .ph { color: var(--brand-ink); margin-top: .15rem; }
.imp8-drop { min-height: 9rem; }
.imp8-bar { flex-wrap: wrap; }
.imp8-map td { vertical-align: middle; }
.imp8-map tr.is-off td:first-child .strong { color: var(--text-3); }
.imp8-map .select { min-width: 12rem; max-width: 22rem; }
.imp8-ex { display: flex; gap: .3rem; flex-wrap: wrap; }
.imp8-ex span { font-size: .75rem; padding: .1rem .45rem; border-radius: var(--r-xs); background: var(--bg-sunken); border: 1px solid var(--line); color: var(--text-2); max-width: 14rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.imp8-auto { color: var(--brand-ink); }
.imp8-kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: .5rem; }
.imp8-kpi { display: flex; flex-direction: column; gap: .15rem; align-items: flex-start; text-align: left; padding: .55rem .75rem; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--bg-elev); color: var(--text-2); font: inherit; font-size: .78rem; font-weight: 650; cursor: pointer; transition: border-color .15s, transform .15s, box-shadow .15s; }
.imp8-kpi b { font-size: 1.35rem; color: var(--text); font-variant-numeric: tabular-nums; line-height: 1.1; }
.imp8-kpi:hover { transform: translateY(-1px); border-color: var(--line-strong); }
.imp8-kpi.is-on { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.imp8-kpi.is-zero { opacity: .55; }
.imp8-kpi[data-tone="success"] b { color: var(--brand-ink); }
.imp8-kpi[data-tone="info"] b { color: var(--info); }
.imp8-kpi[data-tone="warning"] b { color: var(--warning); }
.imp8-kpi[data-tone="danger"] b { color: var(--danger); }
.imp8-objets { display: flex; gap: .4rem 1rem; flex-wrap: wrap; }
.imp8-lines td { vertical-align: top; }
.imp8-clip { max-width: 28rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.imp8-hist .list-row { align-items: center; }
.imp8-hist-counts { display: flex; gap: .3rem; flex-wrap: wrap; justify-content: flex-end; }
.imp8-foot { align-items: center; }
.imp8-actions { flex-wrap: wrap; justify-content: flex-end; }
.imp8-busy { display: inline-flex; align-items: center; gap: .5rem; }
.imp8-spin { width: 1rem; height: 1rem; border-radius: 50%; border: 2px solid var(--line-strong); border-top-color: var(--brand); animation: imp8-spin .7s linear infinite; }
@keyframes imp8-spin { to { transform: rotate(360deg); } }
.imp8-skel { display: grid; gap: .5rem; padding: .8rem; }
.imp8-skel span { height: 3rem; border-radius: var(--r-sm); background: linear-gradient(90deg, var(--bg-sunken), var(--line), var(--bg-sunken)); background-size: 200% 100%; animation: imp8-sh 1.2s infinite; }
@keyframes imp8-sh { to { background-position: -200% 0; } }
.imp8-errors .error-text { display: block; }
@media (max-width: 760px) {
  .imp8-modal { height: calc(100dvh - 32px); }
  .imp8-top { padding: .7rem .9rem; }
  .imp8-top { gap: .6rem; }
  .imp8-stepper { flex: 1 1 100%; order: 2; }
  .imp8-stepper .stepper-label { font-size: .68rem; }
  .imp8-stepper .stepper-item.is-current { flex: 2.6 1 0; }
  .imp8-stepper .stepper-item:not(.is-current) .stepper-label { font-size: 0; }
  .imp8-stepper .stepper-item:not(.is-current) .stepper-label b::before { font-size: .68rem; }
  .imp8-map th:first-child, .imp8-map td:first-child { max-width: 9rem; word-break: break-word; }
  .imp8-switch span { display: none; }
  .imp8-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .imp8-map .select { min-width: 0; width: 100%; max-width: 11rem; }
  .imp8-hist .list-row > .icon-box { display: none; }
  .imp8-clip { max-width: 11rem; }
  .imp8-hist .list-row { flex-wrap: wrap; }
}

/* ---------------------------------------------------------------- Historique des imports (page) */
.imp8-page-counts { display: flex; gap: .3rem; flex-wrap: wrap; }

/* ---------------------------------------------------------------- Tableau de bord */
.d8-trend { font-size: .72rem; font-weight: 700; }
.d8-chart-hint { font-size: .72rem; color: var(--text-3); display: inline-flex; gap: .3rem; align-items: center; }
.d8-funnel { display: grid; gap: .2rem; }
.d8-funnel a { display: grid; grid-template-columns: minmax(7rem, 11rem) 1fr auto 3.2rem; gap: .7rem; align-items: center; color: inherit; text-decoration: none; padding: .25rem .35rem; border-radius: var(--r-xs); }
.d8-funnel a:hover { background: var(--bg-sunken); }
.d8-funnel-bar { height: .7rem; border-radius: var(--r-pill); background: var(--bg-sunken); overflow: hidden; }
.d8-funnel-bar > i { display: block; height: 100%; border-radius: inherit; background: var(--brand); transition: width .6s var(--ease, ease); }
.d8-funnel .d8-rate { font-size: .72rem; color: var(--text-3); text-align: right; font-variant-numeric: tabular-nums; }
.d8-rows { display: grid; }
.d8-row { display: grid; grid-template-columns: 1fr auto; gap: .2rem .8rem; align-items: center; padding: .55rem .9rem; border-bottom: 1px solid var(--line); color: inherit; text-decoration: none; }
.d8-row:last-child { border-bottom: 0; }
.d8-row:hover { background: var(--bg-sunken); }
.d8-row .d8-bar { grid-column: 1 / -1; height: .4rem; border-radius: var(--r-pill); background: var(--bg-sunken); overflow: hidden; }
.d8-row .d8-bar > i { display: block; height: 100%; background: var(--brand); border-radius: inherit; }
.d8-delais { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; padding: .75rem; }
.d8-delai { display: flex; flex-direction: column; gap: .1rem; padding: .5rem .7rem; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--bg-elev); color: inherit; text-decoration: none; }
a.d8-delai:hover { border-color: var(--line-strong); transform: translateY(-1px); }
.d8-delai b { font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.d8-delai span { font-size: .75rem; color: var(--text-2); }
@media (max-width: 640px) {
  .d8-funnel a { grid-template-columns: 6.5rem 1fr auto; }
  .d8-funnel .d8-rate { display: none; }
}
.d8-grid { grid-template-columns: 1fr; }
.d8-sources { display: grid; grid-template-columns: minmax(0, 1fr); gap: .8rem; height: 100%; min-height: 0; }
.d8-canaux { display: flex; flex-direction: column; justify-content: center; gap: .1rem; min-width: 0; }
@media (min-width: 1024px) {
  .d8-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: repeat(2, minmax(210px, 1fr)); min-height: 100%; }
  .d8-sources { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; gap: 1.2rem; }
}

/* ---------------------------------------------------------------- Espace Carrière : pages « écran ajusté » (≥ 1024 px) */
@media (min-width: 1024px) {
  body.f8-cfit .cshell { height: 100dvh; }
  body.f8-cfit .cmain { height: 100dvh; overflow: hidden; }
  body.f8-cfit .cmain > .content { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: hidden; padding-bottom: 1rem; }
  body.f8-cfit .cmain > .content > .page-head { margin-bottom: 1rem; }
  body.f8-cfit .f8-cfill { flex: 1; min-height: 0; display: flex; flex-direction: column; }
  body.f8-cfit .f8-cscroll { flex: 1; min-height: 0; overflow-y: auto; scrollbar-gutter: stable; padding: 2px 4px 2px 2px; margin: -2px -4px -2px -2px; }
  /* Profil : sous-onglets, seule la section active défile */
  body.f8-cfit .f8-profile { flex: 1; min-height: 0; align-items: stretch; }
  body.f8-cfit .f8-profile .profile-nav { position: static; }
  body.f8-cfit .f8-pform { display: flex; flex-direction: column; min-height: 0; }
  body.f8-cfit .f8-pscroll { flex: 1; min-height: 0; overflow-y: auto; scrollbar-gutter: stable; padding: 2px; }
  body.f8-cfit .f8-pform .save-bar { position: static; margin-top: .75rem; border: 1px solid var(--line); border-radius: var(--r); background: var(--bg-elev); flex-wrap: nowrap; padding: .7rem 5.2rem .7rem 1rem; }
  body.f8-cfit .f8-pform .save-bar > .grow { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  body.f8-cfit .f8-pform .save-bar .btn-lg { min-height: 2.75rem; padding: .55rem 1.1rem; font-size: .95rem; }
}
@media (min-width: 1024px) {
  /* Accueil de l'Espace Carrière : les deux colonnes défilent séparément */
  body.f8-cfit .f8-cdash { flex: 1; min-height: 0; overflow-y: auto; align-items: stretch; scrollbar-gutter: stable; }
  body.f8-cfit .feed.f8-cscroll { margin-right: 0; }
}
@media (min-width: 1181px) {
  body.f8-cfit .f8-cdash { overflow: hidden; scrollbar-gutter: auto; } /* pas de gouttière inutile : colonnes alignées sur les cartes du haut */
  body.f8-cfit .f8-cdash > * { min-height: 0; overflow-y: auto; scrollbar-gutter: stable; padding: 2px 6px 2px 2px; }
}
