/* Propriété de l'agent CONTENU : vues Mes erreurs, Explorer, Fiches. */

.errors-view, .browse-view, .fiches-view {
  padding-top: var(--sp-5);
  padding-bottom: var(--sp-6);
}

/* --- Filtres partagés (pastilles qui s'enroulent, jamais de défilement horizontal) --- */
.errors-filter-row, .browse-filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin-bottom: var(--sp-2);
}
.browse-filters {
  margin-bottom: var(--sp-3);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--sp-3);
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}
.browse-filter-group { display: flex; flex-direction: column; gap: var(--sp-2); }
.browse-filter-label {
  font-size: var(--text-xs);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text3);
}
.browse-filter-toggle { position: relative; }
.browse-filter-toggle-label { margin-right: 2px; }
.browse-filter-badge {
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-xs);
}

.errors-toolbar, .browse-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  margin: var(--sp-3) 0;
}
.errors-count, .browse-count {
  font-size: var(--text-sm);
  color: var(--text3);
  font-weight: 600;
}
.errors-sort .segmented { margin: 0; }

.errors-actions, .browse-actions {
  margin-bottom: var(--sp-3);
}
.browse-review-btn { width: 100%; }
@media (min-width: 560px) {
  .browse-review-btn { width: auto; }
}

.errors-rows, .browse-rows {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.errors-row-extra { align-items: center; }
.errors-row-delete { margin-top: var(--sp-2); }

/* --- Recherche Explorer / Fiches --- */
.browse-search-wrap, .fiche-search-wrap {
  position: relative;
  margin-bottom: var(--sp-3);
}
.browse-search-wrap .icon, .fiche-search-wrap .icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text3);
  pointer-events: none;
}
.browse-search, .fiche-search {
  width: 100%;
  padding-left: 40px;
}
.fiche-search-count {
  font-size: var(--text-sm);
  color: var(--text3);
  font-weight: 600;
  margin-bottom: var(--sp-3);
  min-height: 1.2em;
}

.browse-more { display: flex; justify-content: center; margin-top: var(--sp-4); }

mark.browse-hl, mark.fiche-hl {
  background: var(--amber-subtle);
  color: var(--text);
  border-radius: 3px;
  padding: 0 2px;
  box-decoration-break: clone;
}

/* --- Fiches : sommaire + accordéon --- */
.fiches-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--sp-4);
}
@media (min-width: 900px) {
  .fiches-layout { grid-template-columns: 240px 1fr; align-items: start; }
}

.fiches-toc {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--sp-3);
}
.fiches-toc > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  cursor: pointer;
  min-height: 24px;
  list-style: none;
}
.fiches-toc > summary::-webkit-details-marker { display: none; }
.fiches-toc > summary .icon { color: var(--text3); transition: transform var(--dur); }
.fiches-toc[open] > summary .icon { transform: rotate(180deg); }
.fiches-toc-title {
  font-size: var(--text-xs);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text3);
}
.fiches-toc-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: var(--sp-2);
}
@media (min-width: 900px) {
  .fiches-toc { position: sticky; top: calc(var(--appbar-h, 56px) + var(--sp-3)); max-height: calc(100dvh - var(--appbar-h, 56px) - var(--sp-6)); overflow-y: auto; }
  .fiches-toc > summary { cursor: default; pointer-events: none; }
  .fiches-toc > summary .icon { display: none; }
  .fiches-toc-list { display: flex !important; }
}
.fiches-toc-item {
  display: flex;
  align-items: center;
  gap: 8px;
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text2);
  min-height: 40px;
}
.fiches-toc-item:hover { background: var(--card2); color: var(--text); }
@media (max-width: 899px) {
  .fiches-toc-item { border-color: var(--border); }
}

.fiches-list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}

.fiches-top {
  position: fixed;
  right: var(--sp-4);
  bottom: calc(var(--nav-h) + var(--safe-b) + var(--sp-4));
  box-shadow: var(--shadow-lg);
  background: var(--card);
  z-index: 5;
}
.fiches-top-ic { transform: rotate(-90deg); }

/* --- Bloc "Ton rôle de chef d'équipe" : mis en valeur, c'est la relecture avant manœuvre --- */
.role-block {
  margin: var(--sp-4) 0;
  padding: var(--sp-4);
  background: var(--red-subtle);
  border: 1px solid var(--red);
  border-left-width: 4px;
  border-radius: var(--radius);
}
.role-block h4 {
  color: var(--red);
  text-transform: none;
  font-size: var(--text-md);
  font-weight: 800;
  letter-spacing: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: var(--sp-2);
}
.role-block h4::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--red);
  flex-shrink: 0;
}
.role-block ul { padding-left: 20px; }
.role-block li { margin-bottom: 6px; font-size: var(--text-base); line-height: 1.6; }
.role-block li strong { color: var(--red); }

/* Bloc "Références" : traitement sobre de note de bas de fiche, distinct du contenu principal. */
.refs-block {
  margin: var(--sp-4) 0 0;
  padding-top: var(--sp-3);
  border-top: 1px dashed var(--border);
}
.refs-block h4 { margin-top: 0; }
.refs-block ul { padding-left: 20px; }
.refs-block li {
  font-size: var(--text-sm);
  line-height: 1.6;
  color: var(--text2);
  margin-bottom: 4px;
}

/* Impression d'une fiche isolée : masque tout le reste de l'app. */
body.is-printing-fiche .fiches-view > *:not(.fiches-list) { display: none !important; }
body.is-printing-fiche .fiches-list > .fiche { display: none !important; }
body.is-printing-fiche .fiches-list > .fiche.is-print-target { display: block !important; }
@media print {
  body.is-printing-fiche .fiche { page-break-inside: avoid; }
  body.is-printing-fiche .fiche > summary { display: none; }
  body.is-printing-fiche .fiche-footer { display: none; }
}

/* Encadrés présents dans les fiches de data.json : notes, avertissements, tableaux de repères,
   et les deux blocs ajoutés par la refonte du contenu (rôle du chef d'équipe, références). */
.fiche-body .note {
  background: var(--blue-subtle, rgba(37, 99, 235, .08));
  border-left: 3px solid var(--blue);
  border-radius: var(--radius-sm, 8px);
  padding: 10px 12px;
  margin: 12px 0;
  font-size: .92em;
}
.fiche-body .warn {
  color: var(--amber);
  font-weight: 700;
}
.fiche-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0;
  font-size: .9em;
  display: block;
  overflow-x: auto;
}
.fiche-body th,
.fiche-body td {
  border: 1px solid var(--border);
  padding: 6px 9px;
  text-align: left;
  vertical-align: top;
}
.fiche-body th { background: var(--bg2); font-weight: 700 }
.fiche-body h4 { margin: 18px 0 6px; font-size: 1em }
/* Le bloc « Ton rôle de chef d'équipe » est celui qu'on relit avant une manœuvre : il ressort. */
.fiche-body h4:has(+ ul) + ul { margin-left: 1.1em }
.fiche-role {
  background: var(--red-subtle, rgba(214, 40, 40, .07));
  border: 1px solid var(--red);
  border-radius: var(--radius, 12px);
  padding: 12px 14px;
  margin: 16px 0;
}
.fiche-refs {
  border-top: 1px solid var(--border);
  margin-top: 18px;
  padding-top: 10px;
  font-size: .85em;
  color: var(--text2);
}
