/* ════════════════════════════════════════════════════════════════════
   rcm_fiches.css — Fiches d'information et de décision de Moubray
   (étape 7b). À l'écran : couleurs du thème. À l'impression : noir sur
   blanc, A4 paysage, une fiche par page.
   ════════════════════════════════════════════════════════════════════ */

/* ── Barre d'outils (écran seulement) ── */
.fiches-outils {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin-bottom: 20px;
}
.fiches-astuce { font-size: 11.5px; color: var(--muted); }

/* ── Une fiche ── */
.fiche { margin-bottom: 40px; }

/* Cartouche d'en-tête */
.fiche-cartouche {
  width: 100%; border-collapse: collapse; margin-bottom: 8px;
  font-size: 11.5px;
}
.fiche-cartouche td { border: 1px solid var(--border); padding: 5px 8px; vertical-align: top; }
.fiche-cartouche-titre { width: 30%; }
.fiche-titre { font-family: 'Syne', sans-serif; font-weight: 800; font-size: 0.95rem; color: var(--accent); }
.fiche-sous-titre { font-size: 10.5px; color: var(--muted); margin-top: 2px; }
.fiche-lbl {
  display: block; font-size: 9.5px; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--muted);
}
.fiche-blanc { display: inline-block; min-width: 110px; min-height: 1.1em; }
.fiche-blanc.court { min-width: 40px; }

.fiche-contexte {
  font-size: 11.5px; line-height: 1.5; margin-bottom: 8px; padding: 6px 8px;
  border: 1px solid var(--border); border-left: 3px solid #60a5fa;
}

/* ── Tableaux des fiches ── */
.fiche-table { width: 100%; border-collapse: collapse; font-size: 11px; line-height: 1.4; }
.fiche-table th, .fiche-table td {
  border: 1px solid var(--border); padding: 4px 6px; vertical-align: top; text-align: left;
}
.fiche-table th {
  font-family: 'Syne', sans-serif; font-weight: 700; font-size: 10px;
  text-transform: uppercase; letter-spacing: 0.04em;
  background: var(--surface); vertical-align: middle;
}
.fiche-table th span { font-family: inherit; font-weight: 400; text-transform: none; color: var(--muted); }
.fiche-table tr { break-inside: avoid; page-break-inside: avoid; }

/* Fiche d'information : largeur des colonnes */
.fiche-info col.c-fonction { width: 20%; }
.fiche-info col.c-df       { width: 18%; }
.fiche-info col.c-mode     { width: 22%; }
.fiche-info col.c-effets   { width: 40%; }
.fiche-info tr.debut-fonction td { border-top: 2px solid var(--text); }
.cellule-effets div { margin-bottom: 2px; }

.num { font-weight: 800; margin-right: 4px; }
.fiche-ref { font-size: 9.5px; color: var(--muted); margin-top: 2px; }
.fiche-note { font-size: 10px; color: var(--muted); font-style: italic; margin-top: 2px; }
.fiche-vide { color: var(--muted); font-style: italic; }
.fiche-lbl-inline { color: var(--muted); }

/* Fiche de décision : petites colonnes O/N centrées */
.fiche-decision .q { text-align: center; width: 2.6%; white-space: nowrap; }
.fiche-decision .c-tache { width: 38%; }
.fiche-decision .c-intervalle { width: 12%; }
.fiche-decision .c-par { width: 9%; }
.fiche-decision td.rep-O { font-weight: 800; }
.fiche-decision td.rep-N { color: var(--muted); }
.fiche-decision td.rep-manque { color: #fb923c; font-weight: 800; }

.fiche-tache {
  display: inline-block; font-family: 'Syne', sans-serif; font-weight: 800;
  padding: 0 6px; border-radius: 3px; border: 1px solid var(--t); color: var(--t);
}
.fiche-tache-label { margin-left: 4px; }
.fiche-oblig {
  margin-left: 6px; font-size: 9.5px; text-transform: uppercase; font-weight: 700;
  color: #dc2626;
}

.fiche-legende { font-size: 10px; color: var(--muted); line-height: 1.5; margin: 6px 0 12px 0; }

/* Cases de signature */
.fiche-signatures { width: 100%; border-collapse: collapse; font-size: 10px; }
.fiche-signatures td { border: 1px solid var(--border); padding: 4px 6px; width: 25%; color: var(--muted); }
.fiche-signatures tr:last-child td { height: 38px; }

/* ════════════════════════════════════════════════════════════════════
   IMPRESSION
   ════════════════════════════════════════════════════════════════════ */
@page { size: A4 landscape; margin: 10mm; }

@media print {
  /* Noir sur blanc, quel que soit le thème choisi à l'écran */
  :root, :root[data-theme="light"], :root[data-theme="dark"] {
    --bg: #ffffff; --surface: #f1f1f1; --border: #555555;
    --text: #000000; --muted: #444444; --accent: #000000;
  }
  body { background: #ffffff !important; color: #000000; margin: 0; padding: 0; }
  .nav, .no-print { display: none !important; }

  .fiche { margin: 0; break-after: page; page-break-after: always; }
  .fiche:last-of-type { break-after: auto; page-break-after: auto; }

  /* L'en-tête du tableau se répète sur chaque page */
  .fiche-table thead { display: table-header-group; }

  /* Les couleurs de fond ne s'impriment que si on le demande */
  .fiche-table th { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .fiche-tache { border-color: #000000; color: #000000; }
  .fiche-decision td.rep-manque { color: #000000; text-decoration: underline; }
}

/* Tâche retenue contraire à une sortie OBLIGATOIRE de l'arbre (colonne S, H5 HSE) */
.fiche-note.fiche-refus { color: #dc2626; font-style: normal; font-weight: 700; }
@media print { .fiche-note.fiche-refus { color: #000000; text-decoration: underline; } }

/* Étape 9e — colonne RC (catégorie de risque) et lien vers la carte du mode */
.fiche-decision .c-rc { width: 3.2%; }
.fiche-rc {
  display: inline-block; padding: 1px 5px; border-radius: 3px; font-weight: 700; font-size: 0.62rem;
  color: var(--rc); border: 1px solid var(--rc); background: color-mix(in srgb, var(--rc) 12%, transparent);
}
.fiche-lien-mode { color: var(--accent); font-weight: 700; text-decoration: none; }
.fiche-lien-mode:hover { text-decoration: underline; }
@media print { .fiche-lien-mode { color: inherit; } }
