/**
 * Mise en page du compte-rendu - Whisp It
 * S'applique uniquement quand report-layout.js a pose la classe .rpt-on sur le compte-rendu.
 * Style plat, memes couleurs et arrondis que le reste de l application (variables.css).
 * Les post-its et les chemises de dossier gardent leur dessin d origine.
 */

/* ---------- Carte "L'essentiel" ---------- */
.rpt-on .whisp-dark-summary-card {
  border-radius: var(--radius-card);
  padding: 20px 22px;
  box-shadow: none;
}

.rpt-on .dark-card-lead {
  font-size: 16.5px;
  font-weight: 500;
  line-height: 1.45;
  letter-spacing: -0.01em;
}

/* Les piliers detailles remplacent les mini-pastilles de rappel */
.rpt-on .rpt-has-details .dark-card-mini-pills {
  display: none;
}

.rpt-essentiel-details {
  display: grid;
  gap: 16px;
  padding-top: 16px;
  border-top: 1px solid #1e293b;
}

.rpt-essentiel-details .whisp-section-block {
  margin: 0;
  padding: 0;
  background: none;
  border: 0;
}

.rpt-essentiel-details .whisp-block-header {
  display: none;
}

.rpt-essentiel-details .syn-pillars-grid {
  gap: 10px;
}

.rpt-essentiel-details .syn-pillar-card {
  padding: 0;
  background: none;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  gap: 0;
}

.rpt-essentiel-details .decision-num-box {
  display: none;
}

.rpt-essentiel-details .decision-body {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 10px;
}

.rpt-essentiel-details .syn-pillar-pill {
  display: inline-flex;
  align-items: center;
  height: 21px;
  padding: 0 9px;
  border: 1px solid #334155;
  border-radius: var(--radius-pill);
  background: #1e293b;
  color: #ffffff;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: none;
  white-space: nowrap;
}

.rpt-essentiel-details .syn-pillar-text {
  flex: 1 1 260px;
  font-size: 14px;
  line-height: 1.45;
  color: #e2e8f0;
}

/* Chiffres cles dans la carte */
.rpt-essentiel-details .kpi-card {
  padding: 0;
  background: none !important;
  border: 0 !important;
  border-radius: 0;
  box-shadow: none;
  min-height: 0;
}

.rpt-essentiel-details .whisp-section-block > div:has(> .kpi-card) {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 30px;
}

.rpt-essentiel-details .kpi-card .tile-top {
  order: 2;
  margin: 2px 0 0;
}

.rpt-essentiel-details .kpi-card {
  display: flex;
  flex-direction: column;
}

.rpt-essentiel-details .kpi-label {
  font-size: 11.5px;
  font-weight: 600;
  color: #94a3b8;
  text-transform: none;
  letter-spacing: 0;
}

.rpt-essentiel-details .tile-badge-orange {
  display: none;
}

.rpt-essentiel-details .kpi-value,
.rpt-essentiel-details .tile-unit {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: #ffffff;
}

/* ---------- Post-its : poses sous la carte, en rangee ---------- */
.rpt-on .whisp-opening-duo {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.rpt-on .whisp-opening-duo > .postit-inline-wrap {
  width: min(100%, 240px);
  margin-left: 4px;
}

/* ---------- Titres de section ---------- */
.rpt-on .whisp-block-header {
  margin-top: 18px !important;
}

/* ---------- Etapes repliables ---------- */
.rpt-step {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: 18px;
  overflow: hidden;
}

.rpt-step + .rpt-step {
  margin-top: -6px;
}

.rpt-step-head {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 50px;
  padding: 12px 16px;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.rpt-step-head::-webkit-details-marker {
  display: none;
}

.rpt-step-head > h4.report-subsection-title {
  display: none;
}

.rpt-step-num {
  font-family: "JetBrains Mono", monospace;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-muted);
  flex-shrink: 0;
}

.rpt-step-title {
  flex: 1;
  min-width: 0;
  font-size: 14.5px;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.01em;
  color: var(--text-primary);
}

.rpt-step-chevron {
  width: 8px;
  height: 8px;
  margin-right: 4px;
  border-right: 2px solid var(--text-muted);
  border-bottom: 2px solid var(--text-muted);
  transform: rotate(-45deg);
  transition: transform var(--transition-fast);
  flex-shrink: 0;
}

.rpt-step[open] > .rpt-step-head .rpt-step-chevron {
  transform: rotate(45deg);
}

.rpt-step[open] > .rpt-step-head {
  border-bottom: 1px solid var(--border-subtle);
}

.rpt-step-head:hover {
  background: var(--bg-input);
}

.rpt-step-head:focus-visible {
  outline: 2px solid var(--text-primary);
  outline-offset: -2px;
}

.rpt-step-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 16px;
}

.rpt-step-body:empty {
  display: none;
}

/* Dans un volet, les listes n'ont plus leur propre cadre */
.rpt-step-body > .report-list {
  padding: 0;
  background: none;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

/* ---------- Puces : plus de point orange ---------- */
.rpt-on .report-list-dash {
  width: 8px;
  height: 1.5px;
  border-radius: 0;
  background-color: var(--border-input);
  margin-top: 10px;
}

.rpt-on .report-list {
  box-shadow: none;
}

.rpt-on .report-list-item {
  font-size: 14px;
}

/* Libelle au-dessus du texte */
.rpt-on .rpt-point > .report-list-dash,
.rpt-on .rpt-point-head > .report-list-dash {
  display: none;
}

.rpt-on .rpt-point > .report-list-content > strong:first-child,
.rpt-on .rpt-point-head > .report-list-content > strong:first-child {
  display: block;
  margin-bottom: 3px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.rpt-on .rpt-point-head {
  margin-bottom: -6px;
}

/* Decision d'une etape */
.rpt-on .rpt-point-decision {
  padding: 12px 14px;
  border: 1px solid #bbf7d0;
  border-radius: 14px;
  background: #f0fdf4;
}

.rpt-on .rpt-point-decision > .report-list-content {
  color: var(--text-primary);
  font-weight: 500;
}

.rpt-on .rpt-point-decision > .report-list-content > strong:first-child {
  color: #15803d;
}

/* ---------- Decisions actees : numerotees ---------- */
.rpt-on .rpt-decisions,
.rpt-on .rpt-watch {
  counter-reset: rpt-decision;
  gap: 0;
  padding: 0;
  border-radius: 18px;
  overflow: hidden;
}

.rpt-on .rpt-decisions > .report-list-item,
.rpt-on .rpt-watch > .report-list-item {
  align-items: baseline;
  gap: 14px;
  padding: 13px 18px;
  font-size: 14.5px;
  font-weight: 500;
  color: var(--text-primary);
}

.rpt-on .rpt-decisions > .report-list-item + .report-list-item,
.rpt-on .rpt-watch > .report-list-item + .report-list-item {
  border-top: 1px solid var(--border-subtle);
}

.rpt-on .rpt-decisions > .report-list-item {
  counter-increment: rpt-decision;
}

.rpt-on .rpt-decisions .report-list-dash,
.rpt-on .rpt-watch .report-list-dash {
  display: block;
  width: auto;
  height: auto;
  margin: 0;
  background: none;
}

.rpt-on .rpt-decisions .report-list-dash::before {
  content: counter(rpt-decision, decimal-leading-zero);
  font-family: "JetBrains Mono", monospace;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-muted);
}

/* Points de vigilance : losange */
.rpt-on .rpt-watch .report-list-dash::before {
  content: "";
  display: block;
  width: 7px;
  height: 7px;
  border: 1.5px solid var(--text-muted);
  transform: rotate(45deg) translateY(-1px);
}

.rpt-on .rpt-decisions .rpt-point > .report-list-content > strong:first-child,
.rpt-on .rpt-watch .rpt-point > .report-list-content > strong:first-child {
  display: inline;
  margin: 0;
  font-size: inherit;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
  color: var(--text-primary);
}

/* ---------- Dossiers : rangee de chemises en haut du dossier ouvert ---------- */
.dossier-shelf {
  display: flex;
  align-items: flex-end;
  gap: 14px;
  margin: 0 -4px;
  padding: 26px 4px 8px;
  overflow-x: auto;
  scrollbar-width: none;
}

.dossier-shelf::-webkit-scrollbar {
  display: none;
}

.dossier-shelf .dossier-folder {
  display: flex;
  flex-direction: column;
  flex: 1 0 168px;
  max-width: 300px;
  min-height: 0;
  transition: transform 0.28s cubic-bezier(0.34, 1.4, 0.64, 1);
}

.dossier-shelf .dossier-folder-front {
  flex: 1;
  width: 100%;
  min-height: 92px;
  gap: 8px;
  padding: 16px 14px 13px;
  justify-content: space-between;
  filter: saturate(0.6);
  transition: filter var(--transition-fast);
}

.dossier-shelf .dossier-folder-tab {
  width: 40%;
  height: 22px;
  top: -11px;
  filter: saturate(0.6);
}

.dossier-shelf .dossier-folder-sheet {
  height: 44px;
  top: -3px;
}

.dossier-shelf .dossier-folder-name {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: normal;
  font-size: 14.5px;
  line-height: 1.25;
  color: var(--dossier-ink);
}

.dossier-shelf .dossier-folder-count {
  font-size: 11.5px;
  font-weight: 700;
  opacity: 0.8;
}

.dossier-shelf .dossier-folder:not(.is-open):hover .dossier-folder-front,
.dossier-shelf .dossier-folder:not(.is-open):hover .dossier-folder-tab {
  filter: none;
}

.dossier-shelf .dossier-folder:not(.is-open):hover .dossier-folder-name {
  color: var(--dossier-ink);
}

.dossier-shelf .dossier-folder.is-open {
  cursor: default;
  transform: translateY(-6px);
}

.dossier-shelf .dossier-folder.is-open .dossier-folder-front,
.dossier-shelf .dossier-folder.is-open .dossier-folder-tab {
  filter: none;
}

.dossier-shelf .dossier-folder.is-open .dossier-folder-front {
  min-height: 104px;
  box-shadow: 0 6px 14px rgba(15, 23, 42, 0.08);
}

.dossier-shelf .dossier-folder.is-open .dossier-folder-sheet {
  transform: translateY(-11px);
}

.dossier-shelf .dossier-folder.is-open .dossier-folder-name {
  -webkit-line-clamp: 3;
  font-size: 16.5px;
  color: var(--dossier-ink);
}

.dossier-shelf .dossier-folder.is-open .dossier-folder-count {
  opacity: 0.85;
}

/* Le nom du dossier est porte par sa chemise ouverte */
.dossier-shelf + .dossier-report-title {
  display: none;
}

.dossier-report-top .dossier-chip {
  padding: 0;
  background: none;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
}

/* Chemises d'une meme rangee : meme hauteur, contenu cale en haut */
.dossier-grid .dossier-folder {
  display: flex;
  flex-direction: column;
}

.dossier-grid .dossier-folder-front {
  flex: 1;
  width: 100%;
}

/* ---------- Ordinateur ---------- */
@media (min-width: 1024px) {
  .dossier-grid {
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 26px 18px;
  }

  .dossier-grid .dossier-folder,
  .dossier-grid .dossier-folder-front {
    min-height: 150px;
  }

  .dossier-grid .dossier-folder-front {
    padding: 18px 16px 14px;
  }

  .dossier-grid .dossier-folder-name {
    font-size: 18px;
  }

  .dossier-grid .dossier-folder-tab {
    width: 38%;
  }

  .dossier-shelf {
    gap: 18px;
  }

  .dossier-shelf .dossier-folder-front {
    min-height: 100px;
    padding: 18px 16px 14px;
  }

  .dossier-shelf .dossier-folder.is-open .dossier-folder-front {
    min-height: 114px;
  }

  .dossier-shelf .dossier-folder-name {
    font-size: 15.5px;
  }

  .dossier-shelf .dossier-folder.is-open .dossier-folder-name {
    font-size: 18px;
  }

  .rpt-on .whisp-dark-summary-card {
    padding: 24px 26px;
  }

  .rpt-step-head {
    padding: 13px 18px;
  }

  .rpt-step-body {
    padding: 18px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .dossier-shelf .dossier-folder,
  .rpt-step-chevron {
    transition: none;
  }
}
