/* Styles de l'écran kpi. Tout est préfixé par .e-kpi et passe par les variables de core.css. */
.e-kpi { --t-11: .75rem; }
.e-kpi .nd { color: var(--encre-3); font-weight: 600; }

/* ---------- ligne de synthèse ---------- */
.e-kpi .k-ligne { background: var(--hero); color: var(--sur-hero); border-radius: var(--r-3); padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; box-shadow: var(--ombre); min-width: 0; }
.e-kpi .k-ligne-haut { font-size: var(--t-13); color: var(--sur-hero-2); }
.e-kpi .k-ligne-haut b { font-size: var(--t-22); color: var(--sur-hero); margin-right: 2px; }
.e-kpi .k-ligne-roas { font-size: var(--t-13); color: var(--sur-hero-2); }
.e-kpi .k-ligne-roas b { color: var(--sur-hero); }
.e-kpi .k-ligne-fraicheur { font-size: var(--t-11); color: var(--sur-hero-2); }
.e-kpi .segs { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 5px; height: 8px; }
.e-kpi .segs i { border-radius: 4px; animation: kpi-seg .5s cubic-bezier(.2, .8, .2, 1) both; transform-origin: bottom; }
.e-kpi .segs i.bon { background: var(--sur-hero); }
.e-kpi .segs i.mal { background: transparent; box-shadow: inset 0 0 0 2px var(--sur-hero-2); }
.e-kpi .segs i.nul { background: var(--hero-2); }
@keyframes kpi-seg { from { transform: scaleY(.1); opacity: 0; } to { transform: scaleY(1); opacity: 1; } }
.e-kpi .k-actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- les huit indicateurs ---------- */
.e-kpi .chips { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.e-kpi .chip { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; min-width: 0; padding: 9px 8px 9px 10px; background: var(--surface); border-radius: var(--r-2) var(--r-2) var(--r-2) var(--r-1); box-shadow: var(--ombre); position: relative; overflow: hidden; min-height: 78px; text-align: left; transition: transform .12s; }
.e-kpi .chip:active { transform: scale(.96); }
.e-kpi .chip::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--teinte); }
.e-kpi .chip.actif { box-shadow: var(--ombre), inset 0 0 0 2px var(--teinte); }
.e-kpi .chip small { font-size: var(--t-11); font-weight: 700; color: var(--encre-2); letter-spacing: .05em; text-transform: uppercase; }
.e-kpi .chip b { font-size: var(--t-17); line-height: 1.1; white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.e-kpi .chip b.nd { font-size: var(--t-11); line-height: 1.2; white-space: normal; }
.e-kpi .chip .ecart { font-size: 10.5px; padding: 0 4px 0 2px; max-width: 100%; white-space: nowrap; }

/* ---------- cartes par jour ---------- */
.e-kpi .jours { display: flex; flex-direction: column; gap: 10px; }
.e-kpi .jour { display: grid; grid-template-columns: 46px minmax(0, 1fr) 16px; gap: 12px; align-items: center; width: 100%; padding: 12px 10px 12px 12px; background: var(--surface); border-radius: var(--r-3) var(--r-3) var(--r-3) var(--r-1); box-shadow: var(--ombre); text-align: left; transition: transform .12s; min-width: 0; }
.e-kpi .jour:active { transform: scale(.985); }
.e-kpi .j-date { display: flex; flex-direction: column; align-items: flex-start; align-self: stretch; justify-content: center; padding: 4px 0 4px 8px; border-radius: var(--r-2) var(--r-2) var(--r-2) var(--r-1); background: var(--teinte-doux); min-height: 54px; min-width: 0; }
.e-kpi .j-date small { font-size: var(--t-11); font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--encre-2); line-height: 1.1; white-space: nowrap; }
.e-kpi .j-date b { font-size: var(--t-22); line-height: 1; color: var(--teinte); white-space: nowrap; }
.e-kpi .j-centre { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.e-kpi .j-ligne { display: flex; align-items: center; gap: 4px 8px; flex-wrap: wrap; }
.e-kpi .j-val { font-size: var(--t-22); line-height: 1.05; }
.e-kpi .j-barre { height: 8px; border-radius: 3px 5px 5px 3px; background: var(--creux); position: relative; overflow: hidden; }
.e-kpi .j-barre i { position: absolute; left: 0; top: 0; bottom: 0; background: var(--teinte); border-radius: 3px 5px 5px 3px; min-width: 3px; transition: width .5s cubic-bezier(.2, .8, .2, 1); }
.e-kpi .j-barre.neg i { background: var(--critique); }
.e-kpi .j-autres { display: flex; flex-wrap: wrap; gap: 2px 12px; font-size: var(--t-11); color: var(--encre-2); }
.e-kpi .j-autres small { font-size: var(--t-11); }
.e-kpi .j-autres b { color: var(--encre); font-weight: 700; }
.e-kpi .jour > .ico { color: var(--encre-3); width: 16px; height: 16px; }

/* ---------- carte de chaleur ---------- */
.e-kpi .hm-cadre { background: var(--surface); border-radius: var(--r-3) var(--r-3) var(--r-3) var(--r-1); padding: 10px 8px 12px; box-shadow: var(--ombre); display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.e-kpi .hm { display: flex; flex-direction: column; gap: 2px; }
.e-kpi .hm-ligne { display: grid; grid-template-columns: 40px repeat(8, minmax(0, 1fr)); gap: 2px; width: 100%; min-height: 38px; align-items: stretch; text-align: left; }
.e-kpi .hm-tete { min-height: 20px; align-items: end; }
.e-kpi .hm-tete span { font-size: 9.5px; font-weight: 800; letter-spacing: .02em; text-transform: uppercase; color: var(--encre-2); text-align: center; overflow: hidden; text-overflow: clip; white-space: nowrap; }
.e-kpi .hm-lab { font-size: var(--t-11); font-weight: 700; color: var(--encre-2); align-self: center; white-space: nowrap; overflow: hidden; }
.e-kpi .hm-case { display: grid; place-items: center; border-radius: 6px; font-size: 10.5px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--encre); white-space: nowrap; min-width: 0; overflow: hidden; background: var(--creux); }
.e-kpi .hm-case.bon { background: color-mix(in srgb, var(--bon) calc(var(--s) * 52%), var(--surface)); }
.e-kpi .hm-case.mal { background: color-mix(in srgb, var(--critique) calc(var(--s) * 52%), var(--surface)); }
.e-kpi .hm-case.neutre { background: color-mix(in srgb, var(--c2) calc(var(--s) * 45%), var(--surface)); }
.e-kpi .hm-ligne:active .hm-case { filter: brightness(.94); }
.e-kpi .hm-legende { display: flex; flex-direction: column; gap: 4px; padding: 0 4px; }
.e-kpi .hm-lg-barre { height: 10px; border-radius: 5px; background: linear-gradient(to right, color-mix(in srgb, var(--critique) 52%, var(--surface)), var(--surface), color-mix(in srgb, var(--bon) 52%, var(--surface))); box-shadow: inset 0 0 0 1px var(--trait); }
.e-kpi .hm-lg-txt { display: flex; justify-content: space-between; }
.e-kpi .hm-lg-txt small { font-size: var(--t-11); color: var(--encre-2); }

/* quand tombent les ventes : une barre par heure */
.e-kpi .hm3 { display: grid; grid-template-columns: repeat(24, minmax(0, 1fr)); gap: 2px; align-items: stretch; height: 64px; }
.e-kpi .hm3-col { display: flex; align-items: flex-end; min-width: 0; padding: 0; border-radius: 3px; background: var(--creux); }
.e-kpi .hm3-col i { display: block; width: 100%; height: calc(var(--s) * 100%); min-height: 2px; border-radius: 3px; background: color-mix(in srgb, var(--c3) 70%, var(--surface)); }
.e-kpi .hm3-col.pic i { background: var(--c3); }
.e-kpi .hm3-col:active { outline: 2px solid var(--encre); outline-offset: -1px; }
.e-kpi .hm3-h { display: flex; justify-content: space-between; font-size: 10px; color: var(--encre-2); font-variant-numeric: tabular-nums; padding-top: 2px; }
.e-kpi .hm2-lecture { font-size: var(--t-13); font-weight: 600; min-height: 2.6em; }

/* ---------- comparaison ---------- */
.e-kpi .duels { display: flex; flex-direction: column; gap: 10px; }
.e-kpi .duel { display: flex; flex-direction: column; gap: 8px; width: 100%; padding: 12px 14px; background: var(--surface); border-radius: var(--r-3) var(--r-3) var(--r-3) var(--r-1); box-shadow: var(--ombre), inset 4px 0 0 var(--teinte); text-align: left; min-width: 0; transition: transform .12s; }
.e-kpi .duel:active { transform: scale(.985); }
.e-kpi .d-haut { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.e-kpi .d-lab { font-family: var(--f-titre); font-weight: 800; font-size: var(--t-15); }
.e-kpi .d-ligne { display: grid; grid-template-columns: 92px minmax(0, 1fr) auto; gap: 10px; align-items: center; }
.e-kpi .d-ligne small { font-size: var(--t-11); font-weight: 700; color: var(--encre-2); text-transform: uppercase; letter-spacing: .05em; }
.e-kpi .d-ligne b { font-size: var(--t-17); text-align: right; white-space: nowrap; }
.e-kpi .d-ligne.avant b { color: var(--encre-2); font-size: var(--t-15); }
.e-kpi .d-piste { height: 10px; border-radius: 3px 5px 5px 3px; background: var(--creux); position: relative; overflow: hidden; }
.e-kpi .d-piste i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 3px 5px 5px 3px; min-width: 3px; transition: width .5s cubic-bezier(.2, .8, .2, 1); }
.e-kpi .d-piste i.now { background: var(--teinte); }
.e-kpi .d-piste i.av { background: var(--encre-3); }
.e-kpi .fil-jours { display: flex; flex-wrap: wrap; gap: 6px; }
.e-kpi .fj { width: 40px; height: 40px; border-radius: 10px 10px 10px 4px; display: flex; flex-direction: column; align-items: flex-start; justify-content: center; padding-left: 6px; font-size: var(--t-11); line-height: 1.05; background: var(--creux); color: var(--encre-2); }
.e-kpi .fj b { font-family: var(--f-titre); font-stretch: 80%; font-size: var(--t-15); font-weight: 800; }
.e-kpi .fj i { display: block; height: 12px; }
.e-kpi .fj .ico { width: 12px; height: 12px; }
.e-kpi .fj.bon { background: var(--bon-doux); color: var(--bon); }
.e-kpi .fj.mal { background: var(--critique-doux); color: var(--critique); }

/* ---------- classement ---------- */
.e-kpi .podium { max-width: 560px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; align-items: end; }
.e-kpi .pod { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; min-width: 0; text-align: left; }
.e-kpi .pod-vis { display: block; width: 46px; }
.e-kpi .pod.r1 .pod-vis { width: 58px; }
.e-kpi .pod-val { font-size: var(--t-22); line-height: 1; margin-top: 4px; white-space: nowrap; }
.e-kpi .pod-nom { font-size: var(--t-11); color: var(--encre-2); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.e-kpi .pod-socle { width: 100%; margin-top: 4px; display: flex; align-items: flex-start; padding: 6px 8px; background: var(--famille-doux); color: var(--famille); border-radius: var(--r-2) var(--r-2) 0 0; }
.e-kpi .pod.r1 .pod-socle { height: 62px; background: var(--famille); color: var(--sur-accent); }
.e-kpi .pod.r2 .pod-socle { height: 46px; }
.e-kpi .pod.r3 .pod-socle { height: 34px; }
.e-kpi .pod-socle b { font-size: var(--t-15); line-height: 1; }
.e-kpi .rk-liste { background: var(--surface); border-radius: var(--r-3) var(--r-3) var(--r-3) var(--r-1); padding: 4px 14px; box-shadow: var(--ombre); }
.e-kpi .rk-ligne { display: grid; grid-template-columns: 22px 34px minmax(0, 1fr) auto; gap: 4px 10px; align-items: center; width: 100%; padding: 11px 0; border-bottom: 1px solid var(--trait); text-align: left; min-width: 0; }
.e-kpi .rk-ligne:last-child { border-bottom: 0; }
.e-kpi .rk-n { font-size: var(--t-17); color: var(--encre-3); }
.e-kpi .rk-img { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px 10px 10px 4px; background: var(--creux); overflow: hidden; color: var(--encre-3); }
.e-kpi .rk-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.e-kpi .rk-img .ico { width: 16px; height: 16px; }
.e-kpi .pod-vis .rk-img { width: 46px; height: 46px; }
.e-kpi .pod.r1 .pod-vis .rk-img { width: 58px; height: 58px; }
.e-kpi .rk-camp { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px 10px 10px 4px; background: var(--teinte-doux); color: var(--teinte); font-family: var(--f-titre); font-weight: 800; font-size: var(--t-13); }
.e-kpi .pod-vis .rk-camp { width: 46px; height: 46px; font-size: var(--t-17); }
.e-kpi .pod.r1 .pod-vis .rk-camp { width: 58px; height: 58px; font-size: var(--t-22); }
.e-kpi .rk-id { display: flex; flex-direction: column; min-width: 0; }
.e-kpi .rk-id b { font-size: var(--t-13); font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.e-kpi .rk-id small { font-size: var(--t-11); color: var(--encre-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.e-kpi .rk-d { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.e-kpi .rk-d b { font-size: var(--t-17); line-height: 1; white-space: nowrap; }
.e-kpi .rk-mv { display: inline-flex; align-items: center; gap: 1px; font-size: var(--t-11); font-weight: 800; padding: 0 5px 0 3px; border-radius: 6px; background: var(--creux); color: var(--encre-2); font-variant-numeric: tabular-nums; }
.e-kpi .rk-mv .ico { width: 11px; height: 11px; }
.e-kpi .rk-mv.haut { background: var(--bon-doux); color: var(--bon); }
.e-kpi .rk-mv.bas { background: var(--critique-doux); color: var(--critique); }
.e-kpi .rk-barre { grid-column: 2 / -1; height: 7px; border-radius: 3px 4px 4px 3px; background: var(--creux); position: relative; }
.e-kpi .rk-barre i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 3px 4px 4px 3px; min-width: 3px; transition: width .5s cubic-bezier(.2, .8, .2, 1); }
.e-kpi .rk-barre i.bon { background: var(--bon); }
.e-kpi .rk-barre i.critique { background: var(--critique); }
.e-kpi .rk-barre i.neutre { background: var(--famille); }
.e-kpi .rk-barre u { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--encre); margin-left: -1px; }

/* ---------- feuilles ---------- */
.e-kpi.f-corps { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.e-kpi .k-tete { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.e-kpi .k-tete b { font-size: var(--t-44); line-height: 1; }
.e-kpi .k-bloc { display: flex; flex-direction: column; gap: 8px; }
.e-kpi .k-dates { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.e-kpi .pt { display: block; width: 10px; height: 10px; border-radius: 3px; background: currentColor; }

/* ---------- ordinateur ---------- */
@container app (max-width: 520px) {
  .e-kpi .t-cadre td.col-nom, .e-kpi .t-cadre th.col-nom { min-width: 128px; max-width: 150px; }
  .e-kpi .t-vign { width: 26px; height: 26px; }
}
@container app (min-width: 700px) {
  .e-kpi .chips { grid-template-columns: repeat(8, minmax(0, 1fr)); }
  .e-kpi .jours, .e-kpi .duels { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .e-kpi .hm3 { height: 90px; }
  .e-kpi .hm-ligne { grid-template-columns: 56px repeat(8, minmax(0, 1fr)); min-height: 42px; }
  .e-kpi .hm-case { font-size: var(--t-13); }
  .e-kpi .hm-tete span { font-size: var(--t-11); }
}
@container app (max-width: 360px) {
  .e-kpi .chips { gap: 6px; }
  .e-kpi .chip b { font-size: var(--t-15); }
  .e-kpi .d-ligne { grid-template-columns: 84px minmax(0, 1fr) auto; }
}

/* ---------- onglet Tableau (27/11) ---------- */
.e-kpi .t-resume { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.e-kpi .t-res { background: var(--surface); border-radius: var(--r-2); box-shadow: var(--ombre); padding: 9px 10px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.e-kpi .t-res small { font-size: var(--t-11); font-weight: 700; color: var(--encre-2); letter-spacing: .05em; text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.e-kpi .t-res b { font-size: var(--t-17); line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.e-kpi .t-cadre { max-width: 100%; max-height: 70vh; overflow: auto; background: var(--surface); box-shadow: var(--ombre), inset 0 0 0 1px var(--trait); }
.e-kpi .t-cadre table { width: max-content; min-width: 100%; }
.e-kpi .t-cadre thead th { position: sticky; top: 0; z-index: 2; padding: 0; }
.e-kpi .t-cadre thead th.col-nom { z-index: 3; }
.e-kpi .t-cadre tfoot td { position: sticky; bottom: 0; z-index: 2; background: var(--surface-2); font-weight: 800; border-top: 2px solid var(--trait); border-bottom: 0; }
.e-kpi .t-cadre tfoot td.col-nom { z-index: 3; background: var(--surface-2); }
.e-kpi .t-cadre td.col-nom, .e-kpi .t-cadre th.col-nom { min-width: 168px; max-width: 210px; }
.e-kpi .t-tri { all: unset; box-sizing: border-box; display: flex; align-items: center; justify-content: flex-end; gap: 3px; width: 100%; padding: 9px 10px; cursor: pointer; font: inherit; color: inherit; letter-spacing: inherit; text-transform: inherit; white-space: nowrap; }
.e-kpi .t-cadre th.col-nom .t-tri { justify-content: flex-start; }
.e-kpi .t-tri:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: 6px; }
.e-kpi .t-cadre th.trie { color: var(--accent); }
.e-kpi .t-cadre td.trie { background: var(--creux); }
.e-kpi .t-fl { font-size: 8px; }
.e-kpi .t-cadre tbody tr:hover td { background: var(--surface-2); }
.e-kpi .t-cadre tbody tr:hover td.col-nom { background: var(--surface-2); }
.e-kpi .t-nom { display: flex; align-items: center; gap: 8px; min-width: 0; }
.e-kpi .t-nom-txt { display: flex; flex-direction: column; min-width: 0; }
.e-kpi .t-nom-txt b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.e-kpi .t-nom-txt small { font-size: var(--t-11); font-weight: 500; color: var(--encre-2); display: flex; align-items: center; gap: 4px; white-space: nowrap; }
.e-kpi .t-vign { width: 30px; height: 30px; border-radius: 7px; object-fit: cover; flex: none; background: var(--creux); }
.e-kpi .t-pt { width: 7px; height: 7px; border-radius: 50%; background: var(--encre-3); flex: none; }
.e-kpi .t-pt.on { background: var(--bon); box-shadow: 0 0 0 3px var(--bon-doux); }
@container app (max-width: 520px) {
  .e-kpi .t-cadre td.col-nom, .e-kpi .t-cadre th.col-nom { min-width: 128px; max-width: 150px; }
  .e-kpi .t-vign { width: 26px; height: 26px; }
}
@container app (min-width: 700px) {
  .e-kpi .t-resume { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}

/* ---------- objectif de CA par jour (27/11) ---------- */
.e-kpi .k-obj-haut { font-size: var(--t-13); color: var(--encre-2); }
.e-kpi .k-obj-haut b { font-size: var(--t-22); color: var(--encre); margin-right: 2px; }
.e-kpi .k-obj-barre { height: 10px; border-radius: 6px; background: var(--creux); overflow: hidden; margin-top: 8px; }
.e-kpi .k-obj-barre i { display: block; height: 100%; border-radius: 6px; background: var(--accent); transition: width .6s cubic-bezier(.2, .8, .2, 1); }
.e-kpi .k-obj-barre i.ok { background: var(--bon); }
.e-kpi .k-obj-note { font-size: var(--t-13); margin-top: 6px; font-weight: 600; }
.e-kpi .k-obj-jours { font-size: var(--t-13); color: var(--encre-2); margin-top: 10px; }
.e-kpi .k-obj-jours b { color: var(--encre); }
.e-kpi .k-obj-pts { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.e-kpi .k-obj-pts i { width: 12px; height: 12px; border-radius: 4px; background: var(--creux); box-shadow: inset 0 0 0 1px var(--trait); }
.e-kpi .k-obj-pts i.ok { background: var(--bon); box-shadow: none; }

/* 01/12/2026 : téléphone, entêtes de tri à 40 px de haut */
@media (max-width: 699px) { .e-kpi .t-tri { min-height: 40px; } }
@media (max-width: 420px) {
  .e-kpi .hm-cadre { padding-left: 4px; padding-right: 4px; }
  .e-kpi .hm-ligne { grid-template-columns: 40px repeat(8, minmax(0, 1fr)); gap: 1px; }
  .e-kpi .hm-tete span { font-size: 8px; letter-spacing: 0; }
  .e-kpi .hm-lab { font-size: 10px; }
  .e-kpi .hm-case { font-size: 9.5px; }
}
