/* ============================================================================
 * FR·i·maint Solutions — CHARTE MASTER v1.0
 * ----------------------------------------------------------------------------
 * Charte visuelle unique pour TOUS les rapports clients.
 * Référence : rapport-v4.html (Groupe vert validé 28.04.2026).
 *
 * USAGE :
 *   <link rel="stylesheet" href="/css/frimaint-master.css">
 *
 * Modifier ce fichier = modifier la charte de TOUS les rapports.
 *
 * © 2026 Fabien Monney · CMSE® / CECE® / Diplômé Fédéral
 * ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600;700&display=swap');

/* ============================================================================
 *  TOKENS DE DESIGN
 * ========================================================================== */
:root {
  /* Couleurs principales — DO NOT EDIT sans validation Fabien */
  --deep-space:      #020617;
  --deep-space-2:    #0c1222;
  --deep-space-3:    #0f172a;
  --swiss-red:       #dc2626;
  --swiss-red-dark:  #991b1b;
  --cyber-cyan:      #38bdf8;
  --cyber-cyan-dark: #0ea5e9;

  /* Texte */
  --text-primary:    #0f172a;
  --text-secondary:  #475569;
  --text-muted:      #64748b;

  /* Fonds */
  --bg-paper:        #ffffff;
  --bg-subtle:       #f8fafc;
  --bg-soft:         #eff6ff;

  /* Bordures */
  --border:          #e2e8f0;
  --border-strong:   #cbd5e1;

  /* Sémantique */
  --accent-urgent:   #dc2626;
  --accent-warn:     #f59e0b;
  --accent-ok:       #22c55e;
  --accent-info:     #38bdf8;

  /* Typo */
  --font-display:    'Space Grotesk', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono:       'JetBrains Mono', ui-monospace, monospace;

  /* Rayons */
  --radius-sm: 4px;
  --radius:    8px;
  --radius-lg: 10px;

  /* Espacements page A4 */
  --page-pad-x: 32px;
  --page-pad-y: 28px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

/* ============================================================================
 *  RENDU ÉCRAN vs IMPRESSION
 * ========================================================================== */
@media screen {
  body {
    font-family: var(--font-display);
    background: #0a0e17;
    padding: 24px 16px 100px;
    color: var(--text-primary);
  }
  .page {
    background: var(--bg-paper);
    max-width: 860px;
    margin: 0 auto;
    border-radius: var(--radius);
    box-shadow: 0 20px 80px rgba(0, 0, 0, 0.4);
    overflow: hidden;
    position: relative;
  }
}

@media print {
  body {
    margin: 0;
    padding: 0;
    background: #fff;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .btn-print, .btn-back, .btn-lang, .demo-banner { display: none !important; }
  .page { box-shadow: none; border-radius: 0; max-width: 100%; }
  @page { margin: 10mm 12mm; size: A4; }
  .no-break { page-break-inside: avoid; }
}

/* ============================================================================
 *  BOUTONS FLOTTANTS UI (écran uniquement)
 * ========================================================================== */
.btn-print {
  position: fixed; bottom: 28px; right: 28px;
  background: linear-gradient(135deg, var(--cyber-cyan), var(--cyber-cyan-dark));
  color: #fff; border: none; padding: 14px 28px;
  border-radius: var(--radius-lg);
  font-size: 14px; font-weight: 700; cursor: pointer;
  box-shadow: 0 8px 24px rgba(56, 189, 248, 0.4);
  font-family: var(--font-display);
  letter-spacing: -0.01em; z-index: 100;
  transition: transform 0.2s;
}
.btn-print:hover { transform: translateY(-2px); box-shadow: 0 12px 32px rgba(56, 189, 248, 0.5); }

.btn-lang {
  position: fixed; top: 28px; right: 28px;
  background: rgba(20, 25, 40, 0.9); backdrop-filter: blur(10px);
  color: #fff; border: 1px solid rgba(56, 189, 248, 0.3);
  padding: 10px 18px; border-radius: var(--radius);
  font-size: 12px; font-weight: 600; cursor: pointer;
  font-family: var(--font-mono); letter-spacing: 1px;
  z-index: 100; transition: all 0.2s;
}
.btn-lang:hover { border-color: var(--cyber-cyan); background: rgba(56, 189, 248, 0.15); }

.btn-back {
  position: fixed; bottom: 28px; left: 28px;
  background: #fff; color: var(--deep-space);
  border: 2px solid var(--deep-space);
  padding: 12px 24px; border-radius: var(--radius-lg);
  font-size: 13px; font-weight: 700; cursor: pointer;
  font-family: var(--font-display);
}

.demo-banner {
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  padding: 10px 30px; text-align: center;
  font-size: 10pt; color: #78350f; font-weight: 600;
  font-family: var(--font-mono); letter-spacing: 0.5px;
}

.watermark {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%) rotate(-28deg);
  font-family: var(--font-display);
  font-size: 100pt; font-weight: 700;
  color: rgba(220, 38, 38, 0.035);
  letter-spacing: -0.04em;
  pointer-events: none; z-index: 1;
  white-space: nowrap; user-select: none;
}

/* ============================================================================
 *  HEADER OFFICIEL
 * ========================================================================== */
.hdr {
  background: linear-gradient(135deg, var(--deep-space) 0%, var(--deep-space-2) 100%);
  padding: 26px var(--page-pad-x);
  display: flex; justify-content: space-between; align-items: center;
  position: relative; overflow: hidden; z-index: 2;
  border-bottom: 3px solid var(--swiss-red);
}
.hdr::before {
  content: ''; position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(56, 189, 248, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(56, 189, 248, 0.03) 1px, transparent 1px);
  background-size: 28px 28px;
}
.hdr::after {
  content: ''; position: absolute; top: 0; right: 0;
  width: 250px; height: 100%;
  background: radial-gradient(ellipse at top right, rgba(56, 189, 248, 0.08) 0%, transparent 70%);
}

.logo-wrap { display: flex; align-items: center; gap: 16px; position: relative; z-index: 1; }
.logo-mark {
  width: 56px; height: 56px; flex-shrink: 0;
  filter: drop-shadow(0 4px 12px rgba(220, 38, 38, 0.25));
}
.logo-mark svg { width: 100%; height: 100%; }

.logo-text { display: flex; flex-direction: column; gap: 4px; }
.logo-name {
  font-family: var(--font-display); font-weight: 700;
  font-size: 22pt; color: #fff;
  letter-spacing: -0.04em; line-height: 0.95;
  display: flex; align-items: baseline;
}
.logo-name .fr { color: #fff; }
.logo-name .dot-i { color: var(--swiss-red); font-style: normal; font-weight: 700; margin: 0 1px; }
.logo-name .maint { color: #fff; font-weight: 500; }

.logo-tag {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--font-mono);
  font-size: 7pt; color: #94a3b8;
  letter-spacing: 2px; text-transform: uppercase;
}
.logo-tag .dot {
  width: 4px; height: 4px; border-radius: 50%;
  background: var(--cyber-cyan);
  box-shadow: 0 0 8px var(--cyber-cyan);
}
.logo-tag .accent { color: var(--cyber-cyan); }

.hdr-right { text-align: right; position: relative; z-index: 1; }
.hdr-date {
  font-family: var(--font-display); font-size: 13pt;
  font-weight: 700; color: #fff; letter-spacing: -0.02em;
}
.hdr-time {
  font-family: var(--font-mono); font-size: 8pt;
  color: var(--cyber-cyan); margin-top: 3px; letter-spacing: 0.5px;
}
.hdr-ref {
  font-family: var(--font-mono); font-size: 7.5pt;
  color: #64748b; margin-top: 8px;
  padding: 3px 9px;
  background: rgba(56, 189, 248, 0.08);
  border: 1px solid rgba(56, 189, 248, 0.2);
  border-radius: var(--radius-sm);
  display: inline-block; letter-spacing: 0.5px;
}

/* ============================================================================
 *  BANDEAU SOUS-HEADER (badges type / sévérité / équipement)
 * ========================================================================== */
.band {
  background: #0a1628;
  padding: 10px var(--page-pad-x);
  display: flex; gap: 8px; flex-wrap: wrap; align-items: center;
  position: relative; z-index: 2;
  border-bottom: 1px solid rgba(56, 189, 248, 0.1);
}
.badge {
  font-family: var(--font-mono);
  font-size: 7.5pt; font-weight: 700;
  letter-spacing: 1px; text-transform: uppercase;
  padding: 4px 10px; border-radius: var(--radius-sm);
  display: inline-flex; align-items: center; gap: 5px;
}
.badge-type-cur { background: rgba(220,38,38,0.15);  color: #f87171; border: 1px solid rgba(220,38,38,0.3); }
.badge-type-pre { background: rgba(251,146,60,0.15); color: #fdba74; border: 1px solid rgba(251,146,60,0.3); }
.badge-type-prd { background: rgba(56,189,248,0.15); color: var(--cyber-cyan); border: 1px solid rgba(56,189,248,0.3); }
.badge-sev      { background: rgba(251,146,60,0.15); color: #fdba74; border: 1px solid rgba(251,146,60,0.3); }
.badge-eq       { background: rgba(56,189,248,0.08); color: #7dd3fc; border: 1px solid rgba(56,189,248,0.2); }

/* ============================================================================
 *  CORPS DE RAPPORT
 * ========================================================================== */
.body { padding: var(--page-pad-y) var(--page-pad-x); position: relative; z-index: 2; }

.diag-title {
  font-family: var(--font-display); font-size: 18pt; font-weight: 700;
  color: var(--text-primary); margin-bottom: 6px;
  letter-spacing: -0.02em; line-height: 1.15;
}
.diag-sub {
  font-size: 9.5pt; color: var(--text-muted);
  margin-bottom: 18px; line-height: 1.5;
}

.info-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 20px; }
.info-chip {
  font-family: var(--font-mono);
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 5px 11px; font-size: 8pt;
  color: var(--text-secondary); font-weight: 500;
}
.info-chip strong { color: var(--deep-space); font-weight: 700; }

/* Section titrée */
.sec { display: flex; align-items: center; gap: 10px; margin: 22px 0 12px; }
.sec-bar {
  width: 3px; height: 18px;
  background: linear-gradient(180deg, var(--swiss-red), var(--swiss-red-dark));
  border-radius: 2px; flex-shrink: 0;
}
.sec-title {
  font-family: var(--font-display); font-size: 9pt;
  font-weight: 700; letter-spacing: 2px;
  text-transform: uppercase; color: var(--deep-space);
}

/* ============================================================================
 *  ENCART VALIDITÉ (en haut du body)
 * ========================================================================== */
.validity-box {
  background: linear-gradient(135deg, #fff7ed, #fed7aa);
  border: 1px solid #fdba74; border-radius: var(--radius);
  padding: 10px 14px; margin-bottom: 16px;
  font-size: 8.5pt; color: #7c2d12;
  display: flex; align-items: center; gap: 10px;
}
.validity-box strong { color: #431407; }
.validity-box .icon { font-size: 14pt; }

/* ============================================================================
 *  CARTES & RECOMMANDATIONS (sémantique couleur)
 * ========================================================================== */
.mat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 16px; }
.mat-card { display: flex; gap: 12px; align-items: flex-start; padding: 10px 14px; border-radius: var(--radius); border: 1px solid; }
.mat-urgent    { background: linear-gradient(135deg, #fef2f2, #fff5f5); border-color: #fecaca; }
.mat-important { background: linear-gradient(135deg, #fff7ed, #ffedd5); border-color: #fed7aa; }
.mat-conseil   { background: linear-gradient(135deg, #f0fdf4, #dcfce7); border-color: #bbf7d0; }
.mat-ico { font-size: 16px; flex-shrink: 0; }
.mat-title { font-family: var(--font-display); font-size: 9pt; font-weight: 600; color: var(--text-primary); margin-bottom: 2px; }
.mat-desc  { font-family: var(--font-mono); font-size: 7.5pt; color: var(--text-muted); }

.reco-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.reco-card { display: flex; gap: 12px; padding: 12px 14px; border-radius: var(--radius); border: 1px solid; }
.reco-urgent    { background: linear-gradient(135deg, #fef2f2, #fff5f5); border-color: #fecaca; }
.reco-important { background: linear-gradient(135deg, #fff7ed, #ffedd5); border-color: #fed7aa; }
.reco-conseil   { background: linear-gradient(135deg, #f0fdf4, #dcfce7); border-color: #bbf7d0; }
.reco-ico   { font-size: 16px; flex-shrink: 0; }
.reco-title { font-family: var(--font-display); font-size: 9.5pt; font-weight: 700; color: var(--text-primary); margin-bottom: 4px; letter-spacing: -0.01em; }
.reco-desc  { font-size: 8.5pt; color: var(--text-secondary); line-height: 1.6; }

/* ============================================================================
 *  ÉTAPES NUMÉROTÉES
 * ========================================================================== */
.steps { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.step  { display: flex; gap: 12px; }
.step-num {
  width: 34px; height: 34px; border-radius: var(--radius);
  background: linear-gradient(135deg, var(--deep-space), var(--deep-space-3));
  color: #fff; font-family: var(--font-mono);
  font-size: 10pt; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; border: 1px solid rgba(56, 189, 248, 0.3);
}
.step-body  { flex: 1; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: #fff; }
.step-title {
  background: linear-gradient(135deg, var(--bg-subtle), var(--bg-soft));
  padding: 8px 14px;
  font-family: var(--font-display); font-size: 9.5pt; font-weight: 600;
  color: var(--text-primary); border-bottom: 1px solid var(--border);
  letter-spacing: -0.01em;
}
.step-desc   { padding: 8px 14px; font-size: 9pt; color: var(--text-secondary); line-height: 1.6; }
.step-action { padding: 4px 14px 8px; font-size: 9pt; color: var(--deep-space); font-weight: 600; }
.step-action::before { content: '→ '; color: var(--cyber-cyan); font-weight: 700; }
.step-legal  {
  background: linear-gradient(135deg, #fef3f2, #fef2f2);
  border-left: 3px solid var(--swiss-red);
  padding: 8px 14px; font-family: var(--font-mono);
}
.sl-norme { font-size: 7.5pt; color: var(--swiss-red-dark); margin-bottom: 3px; font-weight: 600; }
.sl-sec   { font-size: 7.5pt; color: #78350f;             margin-bottom: 3px; font-weight: 600; }
.sl-epi   { font-size: 7.5pt; color: #14532d;             font-weight: 600; }
.step-metas { padding: 6px 14px 8px; display: flex; gap: 8px; flex-wrap: wrap; border-top: 1px dashed var(--border); }
.step-meta  {
  font-family: var(--font-mono); font-size: 7pt;
  color: var(--text-muted); background: var(--bg-subtle);
  padding: 3px 8px; border-radius: 3px; border: 1px solid var(--border);
}

/* ============================================================================
 *  TABLEAU DES NORMES
 * ========================================================================== */
.normes-tbl {
  width: 100%; border-collapse: collapse;
  font-size: 8pt; margin-bottom: 14px;
  border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden;
}
.normes-tbl thead tr { background: linear-gradient(135deg, var(--deep-space), var(--deep-space-3)); }
.normes-tbl th {
  padding: 9px 14px; text-align: left;
  font-family: var(--font-display); font-weight: 600;
  color: #fff; font-size: 8pt;
  letter-spacing: 1.5px; text-transform: uppercase;
}
.normes-tbl td { padding: 7px 14px; border-bottom: 1px solid var(--border); vertical-align: top; }
.normes-tbl tr:last-child td { border-bottom: none; }
.normes-tbl tr:nth-child(even) td { background: var(--bg-subtle); }
.n-code {
  font-family: var(--font-mono); font-weight: 700;
  color: var(--swiss-red); white-space: nowrap;
  width: 130px; font-size: 8pt;
}
.n-titre { font-weight: 600; color: var(--text-primary); width: 220px; }
.n-app   { color: var(--text-secondary); line-height: 1.5; }

/* ============================================================================
 *  CLAUSE DE DÉCHARGE LÉGALE — CŒUR DU SYSTÈME (validée 28.04.2026)
 *  Remplace l'ancien "legal-attest" qui prétendait à valeur certifiante.
 * ========================================================================== */
.legal-disclaimer {
  background: linear-gradient(135deg, var(--deep-space) 0%, var(--deep-space-2) 100%);
  border-radius: var(--radius-lg);
  padding: 22px 26px; margin: 22px 0;
  position: relative; overflow: hidden;
  border-left: 4px solid var(--swiss-red);
}
.legal-disclaimer::before {
  content: ''; position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(56, 189, 248, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(56, 189, 248, 0.03) 1px, transparent 1px);
  background-size: 20px 20px;
}
.legal-disclaimer::after {
  content: ''; position: absolute; top: -50%; right: -20%;
  width: 300px; height: 300px;
  background: radial-gradient(circle, rgba(220, 38, 38, 0.1) 0%, transparent 70%);
}
.legal-disclaimer-content { position: relative; z-index: 1; }
.legal-disclaimer-title {
  font-family: var(--font-display); font-size: 9.5pt;
  font-weight: 700; color: var(--cyber-cyan);
  text-transform: uppercase; letter-spacing: 2.5px;
  margin-bottom: 12px;
  display: flex; align-items: center; gap: 8px;
}
.legal-disclaimer-title::before {
  content: ''; width: 20px; height: 2px;
  background: var(--swiss-red); display: inline-block;
}
.legal-disclaimer-text {
  font-size: 8.5pt; color: #cbd5e1; line-height: 1.75;
}
.legal-disclaimer-text p { margin-bottom: 8px; }
.legal-disclaimer-text p:last-child { margin-bottom: 0; }
.legal-disclaimer-text strong { color: #fff; }
.legal-disclaimer-text em {
  color: var(--cyber-cyan); font-style: normal; font-weight: 600;
}

/* ============================================================================
 *  ZONE SIGNATURE EXPERT + QR CODE
 * ========================================================================== */
.sig-zone {
  display: flex; gap: 24px; align-items: stretch;
  margin: 22px 0; padding: 18px;
  background: linear-gradient(135deg, var(--bg-subtle), var(--bg-soft));
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  position: relative; overflow: hidden;
}
.sig-zone::before {
  content: ''; position: absolute; top: 0; left: 0;
  width: 4px; height: 100%;
  background: linear-gradient(180deg, var(--swiss-red), var(--cyber-cyan));
}
.sig-block { flex: 1; padding-left: 8px; position: relative; z-index: 1; }
.sig-name {
  font-family: var(--font-display); font-size: 22pt; font-weight: 700;
  color: var(--deep-space); letter-spacing: -0.03em;
  line-height: 1; margin-bottom: 6px;
}
.sig-title {
  font-family: var(--font-mono); font-size: 8pt;
  color: var(--text-muted); text-transform: uppercase;
  letter-spacing: 1.5px; margin-bottom: 4px;
}
.sig-certs {
  font-family: var(--font-display); font-size: 8.5pt;
  color: var(--swiss-red); font-weight: 600; margin-bottom: 10px;
}
.sig-date-line {
  font-family: var(--font-mono); font-size: 7.5pt;
  color: var(--text-muted); margin-top: 4px;
}
.sig-date-line strong { color: var(--deep-space); }

.sig-qr-wrap {
  display: flex; flex-direction: column;
  align-items: center; gap: 6px;
  position: relative; z-index: 1;
}
.sig-qr {
  width: 96px; height: 96px;
  border: 1px solid var(--border-strong);
  border-radius: 6px; padding: 6px; background: #fff;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}
.sig-qr svg { width: 100%; height: 100%; }
.sig-qr-label {
  font-family: var(--font-mono); font-size: 6.5pt;
  color: var(--text-muted); text-align: center; line-height: 1.4;
}
.sig-qr-label strong { color: var(--deep-space); }

/* ============================================================================
 *  FOOTER OFFICIEL
 * ========================================================================== */
.ftr {
  background: linear-gradient(135deg, var(--deep-space), var(--deep-space-2));
  padding: 20px var(--page-pad-x);
  display: flex; justify-content: space-between;
  align-items: flex-start; gap: 24px;
  position: relative; overflow: hidden; z-index: 2;
}
.ftr::before {
  content: ''; position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(56, 189, 248, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(56, 189, 248, 0.03) 1px, transparent 1px);
  background-size: 24px 24px;
}
.ftr-left  { position: relative; z-index: 1; max-width: 540px; }
.ftr-name  { font-family: var(--font-display); font-size: 12pt; font-weight: 700; color: #fff; margin-bottom: 3px; letter-spacing: -0.02em; }
.ftr-certs { font-family: var(--font-mono); font-size: 7.5pt; color: var(--cyber-cyan); margin-bottom: 4px; letter-spacing: 0.5px; }
.ftr-exp   { font-size: 7.5pt; color: #94a3b8; margin-bottom: 8px; }
.ftr-legal {
  font-size: 6.5pt; color: #64748b; font-style: italic;
  margin-top: 8px; border-top: 1px solid rgba(56, 189, 248, 0.15);
  padding-top: 6px; line-height: 1.5;
}
.ftr-right { text-align: right; flex-shrink: 0; position: relative; z-index: 1; }
.ftr-site  { font-family: var(--font-mono); font-size: 8pt; color: #cbd5e1; margin-bottom: 2px; }
.ftr-site .arrow { color: var(--cyber-cyan); margin-right: 4px; }
.ftr-stamp {
  background: rgba(220, 38, 38, 0.15);
  border: 1px solid rgba(220, 38, 38, 0.4);
  border-radius: var(--radius-sm);
  padding: 5px 10px;
  font-family: var(--font-mono); font-size: 7.5pt;
  color: #fca5a5; font-weight: 700;
  margin-top: 8px; white-space: nowrap;
  display: inline-block; letter-spacing: 0.5px;
}
.ftr-hash { font-family: var(--font-mono); font-size: 6pt; color: #475569; margin-top: 6px; letter-spacing: 0.5px; }

.doc-confid {
  font-family: var(--font-mono); font-size: 6.5pt;
  color: var(--text-muted); text-align: center;
  padding: 10px; background: var(--bg-subtle);
  border-top: 1px solid var(--border); letter-spacing: 0.5px;
}

/* ============================================================================
 *  FIN DE LA CHARTE MASTER
 * ========================================================================== */
