.flow-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr) 1.25fr;
  gap: 8px;
  margin: 20px 0 14px;
}
.flow-stats .stat {
  min-height: 110px;
  align-items: flex-start;
  padding: 16px 12px;
  gap: 13px;
}
.flow-stats .stat-icon {
  background: #fff3eb;
  border-radius: 8px;
  padding: 12px;
}
.flow-stats .stat-icon > .icon {
  width: 26px;
  height: 26px;
}
.flow-stats .stat small {
  font-size: 12px;
}
.flow-stats .stat strong {
  font-size: 25px;
  white-space: nowrap;
}
.flow-stats .stat > div > span {
  font-size: 11px;
}
.flow-filters {
  display: flex;
  gap: 7px;
  margin: 14px 0 12px;
}
.flow-filters select {
  font-size: 12px;
  max-width: 190px;
  padding: 8px;
}
.flow-filters .search-field {
  flex: 1;
  min-width: 160px;
}
.flow-filters input {
  width: 100%;
  font-size: 12px;
}
.flow-table {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 7px;
}
.flow-head,
.flow-row {
  display: grid;
  grid-template-columns: 210px repeat(9, minmax(77px, 1fr));
  min-width: 1000px;
  gap: 4px;
  padding: 5px;
}
.flow-head {
  padding-top: 0;
  background: #fafbfc;
  border-bottom: 1px solid var(--line);
  min-height: 70px;
}
.flow-head > strong {
  padding: 18px 12px;
  font-size: 14px;
}
.flow-head > div {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  text-align: center;
  background: #fff3ec;
  padding: 9px 5px 6px;
  border-radius: 6px;
}
.flow-head b {
  font-size: 12px;
  font-weight: 500;
  line-height: 1.15;
}
.flow-head .icon {
  width: 21px;
  height: 21px;
}
.flow-row {
  min-height: 95px;
  border-bottom: 1px solid var(--line);
  align-items: center;
}
.flow-row:last-child {
  border: 0;
}
.flow-project {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 7px 2px;
}
.flow-project > .photo {
  width: 59px;
  height: 63px;
  flex: none;
}
.flow-project > div {
  min-width: 0;
  flex: 1;
}
.flow-project h3 {
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.flow-project p,
.flow-project small {
  font-size: 11px;
  margin-top: 4px;
  color: var(--muted);
}
.flow-project > div > div {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 6px;
}
.flow-project .meter {
  flex: 1;
  height: 6px;
}
.flow-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 74px;
  border: 0;
  border-radius: 5px;
  font-size: 11px;
  padding: 5px 2px;
}
.flow-stage b {
  font-weight: 400;
}
.flow-stage small {
  font-size: 10px;
}
.flow-stage .icon {
  width: 17px;
  height: 17px;
}
.flow-stage.done {
  background: #e4f9ef;
  color: #00864b;
}
.flow-stage.running {
  background: #e4f0ff;
  color: #2a66e5;
}
.flow-stage.upcoming {
  background: #f0f2f5;
  color: #95a0b4;
}
.flow-stage.waiting {
  background: #fff3d0;
  color: #b86c12;
}
.flow-stage.blocked {
  background: #ffe1e5;
  color: #f03342;
}
.flow-legend {
  padding: 4px 13px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.flow-legend > div {
  display: flex;
  gap: 11px;
  align-items: flex-start;
}
.flow-legend i {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  margin-top: 2px;
  background: #9ca5b5;
}
.flow-legend i.done {
  background: #39c296;
}
.flow-legend i.running {
  background: #5893ff;
}
.flow-legend i.waiting {
  background: #ffbe40;
}
.flow-legend i.blocked {
  background: #ff4651;
}
.flow-legend b {
  font-size: 13px;
  font-weight: 400;
}
.flow-legend small {
  display: block;
  font-size: 11px;
}
.flow-alert {
  display: flex;
  gap: 10px;
  align-items: center;
  margin: 5px 12px;
  padding: 10px;
  background: #ffe9eb;
  border-radius: 6px;
  color: #e74246;
  font-size: 13px;
}
.flow-alert span {
  flex: 1;
}
.flow-alert small {
  display: block;
}
@media (max-width: 1250px) {
  .flow-stats {
    grid-template-columns: repeat(3, 1fr);
  }
  .flow-stats .stat {
    min-height: 80px;
    padding: 10px;
  }
  .flow-filters {
    flex-wrap: wrap;
  }
}

/* Flux canonique : une ligne lisible par dossier, les étapes restent défilables. */
.flow-stats {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  margin: 12px 0 10px;
  padding: 12px 16px;
  background: var(--surface, #fff);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 2px 8px rgb(23 39 71 / 6%);
}
.flow-stats > div {
  min-width: 0;
  padding: 2px 14px;
}
.flow-stats > div:first-child {
  padding-left: 0;
}
.flow-stats > div + div {
  border-left: 1px solid var(--line);
}
.flow-stats small {
  display: block;
  margin-bottom: 4px;
  color: #8494b1;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.flow-stats strong {
  display: block;
  overflow: hidden;
  color: #172747;
  font-size: 13px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.flow-filters {
  align-items: center;
  margin: 0;
  min-width: 0;
}
.flow-filters .search-field {
  order: 9;
  flex: 0 1 220px;
  margin-left: auto;
}
.flow-table {
  display: grid;
  gap: 7px;
  overflow: visible;
  border: 0;
  border-radius: 0;
}
.flow-group-row {
  padding: 8px 12px;
  color: var(--text-muted, #6b7280);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}
.flow-row {
  display: grid;
  grid-template-columns: 22px minmax(110px, 135px) minmax(120px, 150px) minmax(0, 1fr) 105px 28px;
  min-width: 0;
  min-height: 68px;
  gap: 12px;
  align-items: center;
  padding: 9px 14px;
  background: var(--surface, #fff);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 2px 8px rgb(23 39 71 / 6%);
}
.flow-row:last-child {
  border: 1px solid var(--line);
}
.flow-row > input[type='checkbox'] {
  margin: 0;
}
.flow-reference,
.flow-project {
  display: block;
  min-width: 0;
  padding: 0;
}
.flow-reference strong,
.flow-project strong,
.flow-reference small,
.flow-project small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.flow-reference strong {
  color: var(--cx-secondary);
  font-size: 12px;
}
.flow-project strong {
  color: #172747;
  font-size: 12px;
}
.flow-reference small,
.flow-project small {
  margin-top: 3px;
  color: #8494b1;
  font-size: 10px;
}
.flow-stages {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 12px;
  overflow-x: auto;
  scrollbar-width: thin;
}
.flow-stage {
  position: relative;
  flex: 0 0 102px;
  height: 46px;
  display: grid;
  grid-template-columns: 13px minmax(0, 1fr);
  grid-template-rows: 18px 15px;
  align-content: center;
  align-items: center;
  column-gap: 3px;
  padding: 4px 7px;
  border: 1px solid currentColor;
  border-radius: 6px;
  text-align: left;
}
.flow-stage:not(:last-child)::after {
  content: '›';
  position: absolute;
  left: calc(100% + 4px);
  color: #bcc7d6;
  font-size: 17px;
}
.flow-stage .flow-status-icon {
  width: 12px;
  height: 12px;
  grid-column: 1;
  grid-row: 1;
}
.flow-stage b {
  grid-column: 2;
  grid-row: 1;
  overflow: hidden;
  font-size: 10px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.flow-stage small {
  grid-column: 1 / -1;
  grid-row: 2;
  overflow: hidden;
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.flow-stage .flow-count {
  display: none;
}
.flow-stage.done {
  background: #ddfae9;
  color: #07964e;
  border-color: #80e9a5;
}
.flow-stage.running {
  background: #e1efff;
  color: #226be2;
  border-color: #93bdfb;
}
.flow-stage.waiting {
  background: #fff1c8;
  color: #ae6500;
  border-color: #ffc85c;
}
.flow-stage.blocked {
  background: #ffe5e7;
  color: #cf3446;
  border-color: #ffadb7;
}
.flow-stage.upcoming {
  background: #f6f7f9;
  color: #a5b0bf;
  border-color: #e6eaf0;
}
.flow-state {
  justify-self: center;
  padding: 4px 9px;
  border-radius: 999px;
  background: #e1efff;
  color: #226be2;
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
}
.flow-state.done {
  background: #ddfae9;
  color: #07964e;
}
.flow-state.late {
  background: #ffe5e7;
  color: #cf3446;
}
.flow-row > .flow-project-menu {
  width: 28px;
  min-width: 28px;
  padding: 4px;
}
@media (max-width: 1000px) {
  .flow-row {
    grid-template-columns: 20px minmax(100px, 125px) minmax(100px, 135px) minmax(0, 1fr) 28px;
    gap: 8px;
  }
  .flow-state {
    display: none;
  }
}
@media (max-width: 720px) {
  .flow-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    row-gap: 12px;
  }
  .flow-stats > div {
    padding: 0 8px;
  }
  .flow-stats > div:nth-child(3) {
    padding-left: 0;
    border-left: 0;
  }
  .flow-row {
    grid-template-columns: 18px minmax(80px, 100px) minmax(0, 1fr) 28px;
  }
  .flow-project {
    grid-column: 3;
  }
  .flow-stages {
    grid-column: 2 / -1;
    grid-row: 2;
  }
  .flow-row > .flow-project-menu {
    grid-column: 4;
    grid-row: 1;
  }
}
