﻿/* ── Variables ─────────────────────────────────────────────── */
:root {
  --navy:    #2C3340;
  --teal:    #B49A6C;
  --ivory:   #F7F5F1;
  --ivory2:  #F0EBE2;
  --white:   #FFFFFF;
  --gray50:  #F7F5F1;
  --gray100: #DDD8CF;
  --gray300: #C4BCB0;
  --gray500: #8C8070;
  --gray700: #3A3530;
  --navy-dark: #1E2530;
  --navy-mid:  #2C3340;
  --green:   #22863A;
  --amber:   #B45309;
  --red:     #B91C1C;

  --radius:  6px;
  --shadow:  0 2px 12px rgba(44,51,64,.08);
  --shadow-md: 0 4px 24px rgba(44,51,64,.12);
  --transition: 0.25s ease;
}

/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }
body {
  font-family: 'DM Sans', system-ui, sans-serif;
  color: var(--gray700);
  background: var(--gray50);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ── ═══════════════════════════════════════════════════════ ── */
/*    FORMULAIRE                                                 */
/* ── ═══════════════════════════════════════════════════════ ── */

#app-form { min-height: 100vh; display: flex; flex-direction: column; }

/* Header form */
.form-header {
  background: var(--navy);
  color: var(--white);
  padding: 0;
  border-bottom: 1px solid rgba(180,154,108,.35);
}
.header-inner {
  max-width: 900px;
  margin: 0 auto;
  padding: 20px 24px;
  display: flex;
  align-items: center;
  gap: 24px;
}
.logo-wrap {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
}
.logo-wrap svg { width: 48px; height: 48px; }
.logo-wrap svg .cls-1 { fill: var(--white); }
.cabinet-name { line-height: 1.2; }
.cabinet-main {
  display: block;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--white);
}
.cabinet-sub {
  display: block;
  font-size: 10px;
  color: var(--teal);
  letter-spacing: 1px;
  font-weight: 500;
}
.header-divider {
  width: 1px;
  height: 44px;
  background: rgba(255,255,255,.25);
  flex-shrink: 0;
}
.app-title h1 {
  font-size: 18px;
  font-weight: 700;
  color: var(--white);
  line-height: 1.2;
}
.app-title p {
  font-size: 11px;
  color: var(--teal);
  margin-top: 3px;
  font-weight: 500;
  letter-spacing: .5px;
}
.header-back {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  font-size: 11px;
  font-weight: 500;
  color: rgba(255,255,255,.6);
  padding: 6px 12px;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 4px;
  flex-shrink: 0;
  transition: color .2s, border-color .2s;
}
.header-back:hover {
  color: var(--white);
  border-color: rgba(180,154,108,.5);
}

/* Main form */
.form-main {
  max-width: 900px;
  margin: 32px auto;
  padding: 0 24px;
  flex: 1;
}
.form-section {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 20px;
  overflow: hidden;
}
.section-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 24px;
  background: var(--navy);
  color: var(--white);
}
.section-num {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--teal);
  background: rgba(180,154,108,.15);
  border: 1px solid rgba(180,154,108,.4);
  border-radius: 4px;
  padding: 2px 8px;
}
.section-header h2 {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: .5px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  padding: 24px;
}
@media (max-width: 580px) {
  .form-grid { grid-template-columns: 1fr; }
}

.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group.full { grid-column: 1/-1; }

.form-group label {
  font-size: 12px;
  font-weight: 600;
  color: var(--navy);
  letter-spacing: .3px;
  text-transform: uppercase;
}
.required-mark { color: var(--teal); }

.input-wrap { position: relative; }
.input-wrap input { padding-right: 56px; }
.input-unit {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 11px;
  font-weight: 600;
  color: var(--teal);
  background: var(--ivory);
  padding: 2px 6px;
  border-radius: 4px;
  pointer-events: none;
}

input, select {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--gray100);
  border-radius: var(--radius);
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  color: var(--gray700);
  background: var(--white);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}
input:focus, select:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(180,154,108,.12);
}
input::placeholder { color: var(--gray300); }
input.error { border-color: var(--red); }

.help-text { font-size: 11px; color: var(--gray500); }

/* Optional section (details/summary) */
.optional-section {
  border-top: 1px dashed var(--gray100);
  margin: 0 24px 24px;
}
.optional-section summary {
  font-size: 12px;
  font-weight: 600;
  color: var(--navy-mid);
  cursor: pointer;
  padding: 12px 0;
  letter-spacing: .3px;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
}
.optional-section summary::before {
  content: '+';
  width: 18px;
  height: 18px;
  background: var(--teal);
  color: var(--white);
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
}
.optional-section[open] summary::before { content: '−'; }
.mt-16 { margin-top: 16px; }

/* Form actions */
.form-actions {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-top: 8px;
}
.btn-primary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 32px;
  background: var(--teal);
  color: var(--white);
  border: none;
  border-radius: var(--radius);
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: .5px;
  cursor: pointer;
  transition: background var(--transition), transform var(--transition), box-shadow var(--transition);
  box-shadow: 0 4px 14px rgba(180,154,108,.30);
}
.btn-primary:hover {
  background: #9A845A;
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(180,154,108,.40);
}
.btn-primary svg { width: 18px; height: 18px; flex-shrink: 0; }
.btn-secondary {
  padding: 12px 24px;
  background: transparent;
  color: var(--navy);
  border: 1.5px solid var(--navy);
  border-radius: var(--radius);
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}
.btn-secondary:hover { background: var(--navy); color: var(--white); }

.form-error {
  margin-top: 12px;
  padding: 12px 16px;
  background: #FEF2F2;
  border: 1px solid #FECACA;
  border-radius: var(--radius);
  color: var(--red);
  font-size: 13px;
  font-weight: 500;
}

/* Form footer */
.form-footer {
  background: var(--navy-dark);
  color: rgba(255,255,255,.5);
  text-align: center;
  padding: 14px 24px;
  font-size: 11px;
  letter-spacing: .5px;
}

/* ── ═══════════════════════════════════════════════════════ ── */
/*    RAPPORT                                                    */
/* ── ═══════════════════════════════════════════════════════ ── */

#app-report { min-height: 100vh; background: var(--gray50); }

/* Report header */
.report-header {
  background: var(--navy);
  border-bottom: 1px solid rgba(180,154,108,.35);
  padding: 18px 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.rh-left {
  display: flex;
  align-items: center;
  gap: 14px;
}
.rh-left svg { width: 44px; height: 44px; }
.rh-left svg .cls-1 { fill: var(--white); }
.rh-cabinet {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--white);
}
.rh-sub { font-size: 10px; color: var(--teal); letter-spacing: 1px; }
.rh-right { text-align: right; }
.rh-doc-type {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 2.5px;
  color: var(--teal);
  text-transform: uppercase;
}
.rh-doc-meta {
  font-size: 12px;
  color: rgba(255,255,255,.7);
  margin-top: 3px;
}

/* Report body */
.report-body {
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 40px 48px;
}

/* ROE Summary Card */
.roe-card {
  background: var(--navy);
  border-radius: var(--radius);
  padding: 28px 36px;
  margin-bottom: 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
}
.roe-card::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 5px;
  background: var(--teal);
}
.roe-card-left { flex: 1; }
.roe-card-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--teal);
  text-transform: uppercase;
  margin-bottom: 8px;
}
.roe-card-formula {
  font-size: 12px;
  color: rgba(255,255,255,.6);
  margin-bottom: 12px;
  font-style: italic;
}
.roe-card-diagnosis {
  font-size: 14px;
  color: var(--white);
  line-height: 1.5;
  max-width: 560px;
}
.roe-card-right {
  text-align: center;
  flex-shrink: 0;
}
.roe-value-label {
  font-size: 10px;
  letter-spacing: 1.5px;
  color: rgba(255,255,255,.6);
  text-transform: uppercase;
  margin-bottom: 6px;
}
.roe-value {
  font-size: 52px;
  font-weight: 700;
  color: var(--teal);
  line-height: 1;
}
.roe-badge {
  display: inline-block;
  margin-top: 10px;
  padding: 4px 14px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
}
.badge-excellent { background: #D1FAE5; color: #065F46; }
.badge-bon       { background: #DBEAFE; color: #1E40AF; }
.badge-acceptable{ background: #FEF3C7; color: #92400E; }
.badge-faible    { background: #FEE2E2; color: #991B1B; }
.badge-critique  { background: #7F1D1D; color: var(--white); }

/* Report sections */
.report-section {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 24px;
  overflow: hidden;
}
.section-title {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 28px;
  background: var(--navy);
  color: var(--white);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .5px;
  text-transform: uppercase;
}
.section-title .num {
  width: 24px;
  height: 24px;
  background: var(--teal);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--white);
  flex-shrink: 0;
}

/* DuPont Tree */
.dupont-tree {
  padding: 32px 24px;
  overflow-x: auto;
}
.tree-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 700px;
}

/* Level 0: ROE */
.tree-node-roe {
  background: var(--navy);
  color: var(--white);
  border-radius: var(--radius);
  padding: 14px 48px;
  text-align: center;
  box-shadow: var(--shadow-md);
}
.tree-node-roe .tn-label {
  font-size: 10px;
  letter-spacing: 2px;
  color: var(--teal);
  text-transform: uppercase;
}
.tree-node-roe .tn-value {
  font-size: 32px;
  font-weight: 700;
  color: var(--white);
}
.tree-node-roe .tn-sub { font-size: 10px; color: rgba(255,255,255,.5); }

/* Tree connectors */
.tree-connector-v {
  width: 2px;
  height: 24px;
  background: var(--teal);
  margin: 0 auto;
}
.tree-connector-h {
  width: 60%;
  height: 2px;
  background: var(--teal);
  position: relative;
}
.tree-row {
  display: flex;
  align-items: flex-start;
  gap: 0;
  width: 100%;
  justify-content: center;
}
.tree-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  max-width: 230px;
}
.tree-col .tree-connector-v { height: 24px; }

/* Level 1: Composants */
.tree-node-comp {
  background: var(--teal);
  color: var(--white);
  border-radius: var(--radius);
  padding: 10px 16px;
  text-align: center;
  width: 100%;
  max-width: 200px;
  box-shadow: var(--shadow);
}
.tree-node-comp .tn-label { font-size: 9px; letter-spacing: 1px; opacity: .85; }
.tree-node-comp .tn-value { font-size: 22px; font-weight: 700; }
.tree-node-comp .tn-sub { font-size: 10px; opacity: .8; }

/* Level 2: Fractions */
.tree-node-frac {
  background: var(--gray50);
  border: 1.5px solid var(--gray100);
  border-radius: var(--radius);
  padding: 10px 12px;
  text-align: center;
  width: 100%;
  max-width: 200px;
}
.frac-num {
  font-size: 11px;
  font-weight: 600;
  color: var(--navy);
  padding-bottom: 5px;
  border-bottom: 1.5px solid var(--teal);
  margin-bottom: 5px;
}
.frac-den {
  font-size: 11px;
  color: var(--gray500);
}
.frac-values {
  margin-top: 6px;
  font-size: 10px;
  color: var(--teal);
  font-weight: 600;
}

/* Times symbol between columns */
.tree-times {
  display: flex;
  align-items: center;
  padding: 0 8px;
  font-size: 24px;
  font-weight: 700;
  color: var(--teal);
  margin-top: 32px;
}

/* Ratios Grid */
.ratios-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  padding: 28px;
}
@media (max-width: 720px) {
  .ratios-grid { grid-template-columns: 1fr; }
}

.ratio-card {
  border: 1px solid var(--gray100);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.ratio-card-header {
  background: var(--navy);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.ratio-card-num {
  width: 28px;
  height: 28px;
  background: var(--teal);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--white);
  flex-shrink: 0;
}
.ratio-card-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--white);
  letter-spacing: .3px;
}
.gauge-wrap { padding: 20px 16px 8px; }
.gauge-svg { width: 100%; max-width: 220px; display: block; margin: 0 auto; }

.ratio-formula {
  text-align: center;
  font-size: 10px;
  font-style: italic;
  color: var(--gray500);
  padding: 0 16px 12px;
}
.ratio-level {
  text-align: center;
  margin: 0 16px 12px;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .5px;
  text-transform: uppercase;
}
.ratio-comment {
  padding: 14px 16px;
  background: var(--gray50);
  border-top: 1px solid var(--gray100);
  font-size: 12px;
  color: var(--gray700);
  line-height: 1.6;
  flex: 1;
}

/* Gauge colors by level */
.level-excellent { background: #D1FAE5; color: #065F46; }
.level-bon       { background: #DBEAFE; color: #1E40AF; }
.level-acceptable{ background: #FEF3C7; color: #92400E; }
.level-faible    { background: #FEE2E2; color: #991B1B; }
.level-critique  { background: #7F1D1D; color: var(--white); }
.level-modere    { background: #EDE9FE; color: #5B21B6; }

/* Chart section */
.chart-inner {
  padding: 28px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
  align-items: start;
}
@media (max-width: 720px) { .chart-inner { grid-template-columns: 1fr; } }
.chart-box { position: relative; height: 260px; }
.chart-box canvas { max-height: 260px; }
.chart-legend-box { padding: 20px; background: var(--gray50); border-radius: var(--radius); }
.chart-legend-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--navy);
  letter-spacing: .5px;
  text-transform: uppercase;
  margin-bottom: 14px;
}
.legend-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 12px;
}
.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 4px;
}
.legend-text { font-size: 12px; color: var(--gray700); line-height: 1.5; }
.legend-text strong { color: var(--navy); }

/* Recommendations */
.reco-inner { padding: 24px 28px; }
.reco-global {
  background: var(--navy);
  color: var(--white);
  border-radius: var(--radius);
  padding: 18px 22px;
  margin-bottom: 20px;
  font-size: 13px;
  line-height: 1.65;
  position: relative;
  padding-left: 30px;
}
.reco-global::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 5px;
  background: var(--teal);
  border-radius: var(--radius) 0 0 var(--radius);
}
.reco-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}
.reco-table th {
  background: var(--navy);
  color: var(--white);
  padding: 10px 14px;
  text-align: left;
  font-size: 11px;
  letter-spacing: .5px;
  text-transform: uppercase;
  font-weight: 600;
}
.reco-table th:first-child { border-radius: 0; }
.reco-table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--gray100);
  color: var(--gray700);
  vertical-align: top;
  line-height: 1.55;
}
.reco-table tr:last-child td { border-bottom: none; }
.reco-table tr:nth-child(even) td { background: var(--gray50); }
.reco-priorite {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .5px;
  text-transform: uppercase;
}
.prio-haute   { background: #FEE2E2; color: var(--red); }
.prio-moyenne { background: #FEF3C7; color: var(--amber); }
.prio-faible  { background: #D1FAE5; color: var(--green); }
.prio-info    { background: #DBEAFE; color: #1E40AF; }

/* N vs N-1 comparison (optional) */
.compare-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  padding: 24px 28px;
}
.compare-card {
  background: var(--gray50);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
  border: 1px solid var(--gray100);
}
.compare-card-label { font-size: 10px; font-weight: 700; color: var(--navy); letter-spacing: .5px; text-transform: uppercase; margin-bottom: 6px; }
.compare-val-n { font-size: 22px; font-weight: 700; color: var(--navy); }
.compare-val-n1 { font-size: 13px; color: var(--gray500); margin-top: 2px; }
.compare-delta { font-size: 12px; font-weight: 700; margin-top: 6px; }
.delta-up { color: var(--green); }
.delta-down { color: var(--red); }
.delta-flat { color: var(--gray500); }

/* Methodology */
.methodology-content { padding: 24px 28px; }
.methodology-content p { font-size: 12.5px; color: var(--gray700); line-height: 1.7; margin-bottom: 10px; }
.method-formula {
  background: var(--navy);
  color: var(--white);
  border-radius: var(--radius);
  padding: 16px 22px;
  font-size: 13px;
  font-style: italic;
  margin: 16px 0;
  text-align: center;
  letter-spacing: .5px;
}
.method-formula span { color: var(--teal); font-weight: 700; }
.method-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-top: 16px;
}
@media (max-width: 600px) { .method-grid { grid-template-columns: 1fr; } }
.method-item {
  background: var(--gray50);
  border: 1px solid var(--gray100);
  border-radius: var(--radius);
  padding: 14px;
}
.method-item-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--teal);
  letter-spacing: .5px;
  text-transform: uppercase;
  margin-bottom: 6px;
}
.method-item p { font-size: 11.5px; line-height: 1.6; margin: 0; }

/* Report actions */
.report-actions {
  display: flex;
  gap: 14px;
  justify-content: center;
  padding: 20px 40px 32px;
  background: var(--gray50);
}
.btn-pdf {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 13px 28px;
  background: var(--teal);
  color: var(--white);
  border: none;
  border-radius: var(--radius);
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition);
}
.btn-pdf:hover { background: #9A845A; }

.btn-print {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 13px 28px;
  background: var(--navy);
  color: var(--white);
  border: none;
  border-radius: var(--radius);
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition);
}
.btn-print:hover { background: var(--navy-mid); }

.btn-edit {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 13px 28px;
  background: transparent;
  color: var(--orange);
  border: 1.5px solid var(--orange);
  border-radius: var(--radius);
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition);
}
.btn-edit:hover { background: var(--orange); color: var(--white); }

/* Report footer */
.report-footer {
  background: var(--navy-dark);
  color: rgba(255,255,255,.4);
  padding: 14px 40px;
  display: flex;
  justify-content: space-between;
  font-size: 10.5px;
  letter-spacing: .5px;
}

/* Gauge arc animation */
.gauge-arc {
  transition: stroke-dasharray 1.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Sections détail formulaire ──────────────────────────── */
.form-section-detail {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 20px;
  overflow: hidden;
  border: 1.5px dashed var(--teal);
}
.form-section-detail > summary {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 24px;
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-mid) 100%);
  color: var(--white);
  cursor: pointer;
  list-style: none;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: .3px;
  transition: background var(--transition);
}
.form-section-detail > summary:hover { background: var(--navy-mid); }
.form-section-detail > summary .section-num { font-size: 11px; }
.detail-badge {
  margin-left: auto;
  background: var(--teal);
  color: var(--white);
  font-size: 10px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 12px;
  letter-spacing: 1px;
  text-transform: uppercase;
}
.detail-body { padding: 24px; }
.detail-intro {
  font-size: 12.5px;
  color: var(--gray500);
  line-height: 1.6;
  margin-bottom: 18px;
  padding: 10px 14px;
  background: var(--gray50);
  border-left: 3px solid var(--teal);
  border-radius: 0 var(--radius) var(--radius) 0;
}
.detail-subsection-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--teal);
  margin-bottom: 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--gray100);
}
.detail-unit { background: rgba(180,154,108,.10); color: var(--teal); }

/* ── Arbre étendu ─────────────────────────────────────────── */
.extended-tree-wrap {
  padding: 24px 20px 8px;
  overflow-x: auto;
}
.etree {
  display: flex;
  align-items: stretch;
  gap: 0;
  min-width: 900px;
  font-size: 11px;
}
.etree-col {
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  gap: 6px;
}
.etree-connector {
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  width: 28px;
  flex-shrink: 0;
}
.etree-line-h {
  height: 2px;
  background: var(--teal);
  width: 100%;
  flex-shrink: 0;
}
.etree-branch {
  display: flex;
  flex-direction: column;
  position: relative;
}
.etree-branch::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  bottom: 0;
  width: 2px;
  background: var(--teal);
}
.etree-node {
  border-radius: 6px;
  padding: 7px 10px;
  text-align: center;
  white-space: nowrap;
  border: 1.5px solid transparent;
  line-height: 1.3;
}
.etree-node.root {
  background: var(--navy);
  color: var(--white);
  font-weight: 700;
  font-size: 12px;
  padding: 10px 14px;
}
.etree-node.level1 {
  background: var(--navy-mid);
  color: var(--white);
  border-color: var(--teal);
  font-weight: 600;
}
.etree-node.level2 {
  background: var(--teal);
  color: var(--white);
  font-weight: 600;
}
.etree-node.level3 {
  background: var(--white);
  border-color: var(--gray100);
  color: var(--navy);
  font-weight: 500;
}
.etree-node.level4 {
  background: var(--gray50);
  border-color: var(--gray100);
  color: var(--gray700);
  font-size: 10px;
}
.etree-node .ev { font-size: 13px; font-weight: 700; color: var(--teal); display: block; }
.etree-node.level2 .ev { color: var(--white); font-size: 14px; }
.etree-node.root .ev { color: var(--teal); font-size: 18px; }
.etree-op {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  flex-shrink: 0;
  font-size: 18px;
  font-weight: 700;
  color: var(--teal);
}
.etree-spacer { flex: 1; }

/* ── Panneaux analyse étendue ─────────────────────────────── */
.extended-panels {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  padding: 8px 20px 24px;
}
@media (max-width: 720px) { .extended-panels { grid-template-columns: 1fr; } }

.ext-panel {
  background: var(--gray50);
  border-radius: var(--radius);
  border: 1px solid var(--gray100);
  overflow: hidden;
}
.ext-panel-header {
  background: var(--navy);
  color: var(--white);
  padding: 10px 16px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .5px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.ext-panel-header .dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--teal);
  flex-shrink: 0;
}
.ext-panel-body { padding: 16px; }

/* Barres de décomposition */
.decomp-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.decomp-label {
  font-size: 11px;
  color: var(--navy);
  font-weight: 500;
  width: 130px;
  flex-shrink: 0;
}
.decomp-bar-wrap {
  flex: 1;
  background: var(--gray100);
  border-radius: 4px;
  height: 18px;
  overflow: hidden;
}
.decomp-bar {
  height: 100%;
  border-radius: 4px;
  transition: width 1s ease;
  display: flex;
  align-items: center;
  padding-left: 6px;
  font-size: 10px;
  font-weight: 700;
  color: var(--white);
  white-space: nowrap;
  min-width: 30px;
}
.decomp-val {
  font-size: 11px;
  font-weight: 700;
  color: var(--navy);
  width: 56px;
  text-align: right;
  flex-shrink: 0;
}
.decomp-divider {
  height: 1px;
  background: var(--teal);
  margin: 10px 0;
}
.decomp-total {
  font-size: 12px;
  font-weight: 700;
  color: var(--navy);
  display: flex;
  justify-content: space-between;
  padding-top: 4px;
}

/* Ratios dérivés */
.derived-ratios { margin-top: 14px; }
.derived-ratio-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  background: var(--white);
  border-radius: 6px;
  margin-bottom: 6px;
  border: 1px solid var(--gray100);
}
.dri-label { font-size: 11px; color: var(--gray700); }
.dri-val { font-size: 13px; font-weight: 700; color: var(--teal); }
.dri-comment { font-size: 10px; color: var(--gray500); }

/* ── ═══════════════════════════════════════════════════════ ── */
/*    DONNÉES COMPARATIVES — FORMULAIRE (3 exercices)            */
/* ── ═══════════════════════════════════════════════════════ ── */

.comp-years-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  padding: 16px 0 8px;
}
@media (max-width: 680px) {
  .comp-years-grid { grid-template-columns: 1fr; }
}
.comp-year-col {
  background: var(--gray50);
  border: 1.5px solid var(--gray100);
  border-radius: var(--radius);
  padding: 16px 18px;
}
.comp-year-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--gray100);
}
.year-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  height: 26px;
  padding: 0 12px;
  border-radius: 5px;
  background: var(--navy);
  color: var(--white);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  flex-shrink: 0;
}
.year-badge-n2 { background: var(--gray500); }
.year-input {
  flex: 1;
  padding: 6px 10px;
  font-size: 13px;
  color: var(--navy);
  border: 1.5px solid var(--gray100);
  border-radius: var(--radius);
  background: var(--white);
  width: 0;          /* override global width:100% */
  min-width: 0;
  font-family: 'DM Sans', sans-serif;
  outline: none;
}
.year-input:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(180,154,108,.12);
}
.comp-year-col .form-group { margin-bottom: 8px; }
.comp-year-col .form-group label {
  font-size: 11px;
  font-weight: 600;
  color: var(--gray500);
  text-transform: uppercase;
  letter-spacing: .3px;
  margin-bottom: 3px;
}
.comp-year-col input[type="number"] {
  padding: 8px 12px;
  font-size: 13px;
}

/* ── Grille 3 exercices (sections 05 / 06) ──────────────────── */
.year-badge-cur { background: var(--teal); }

.tri-grid-wrap {
  margin-top: 4px;
}
.tri-head, .tri-row {
  display: grid;
  grid-template-columns: 220px repeat(3, 1fr);
  gap: 8px;
  align-items: center;
  padding: 7px 0;
  border-bottom: 1px solid var(--gray100);
}
.tri-head {
  font-size: 11px;
  font-weight: 700;
  color: var(--navy);
  padding-bottom: 10px;
  border-bottom: 2px solid var(--gray100);
  margin-bottom: 2px;
}
.tri-label-col {
  font-size: 12px;
  font-weight: 600;
  color: var(--gray700);
  padding-right: 8px;
}
.tri-help {
  display: block;
  font-size: 10px;
  font-weight: 400;
  color: var(--gray500);
  margin-top: 1px;
}
.tri-year-col {
  text-align: center;
}
.tri-year-col input[type="number"] {
  width: 100%;
  padding: 7px 8px;
  font-size: 12px;
  text-align: right;
  border: 1.5px solid var(--gray100);
  border-radius: 6px;
  background: var(--white);
  color: var(--navy);
  font-family: 'DM Sans', sans-serif;
  box-sizing: border-box;
  transition: border-color var(--transition);
}
.tri-year-col input[type="number"]:focus {
  border-color: var(--teal);
  outline: none;
  box-shadow: 0 0 0 3px rgba(180,154,108,.10);
}
.tri-readonly {
  background: rgba(180,154,108,.07) !important;
  border-color: rgba(180,154,108,.30) !important;
  color: var(--teal) !important;
  font-weight: 700;
  cursor: default;
}
.tri-subsec {
  grid-column: 1/-1;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--navy-mid);
  background: rgba(44,51,64,.06);
  padding: 5px 8px;
  border-radius: 4px;
  margin-top: 6px;
}
/* Les .tri-row contenant .tri-subsec occupent toute la largeur */
.tri-grid-wrap .tri-subsec {
  display: block;
}
@media (max-width: 640px) {
  .tri-head, .tri-row {
    grid-template-columns: 140px repeat(3, 1fr);
    font-size: 11px;
  }
  .tri-label-col { font-size: 11px; }
}

/* ── ═══════════════════════════════════════════════════════ ── */
/*    ANALYSE TENDANCIELLE 3 EXERCICES — RAPPORT                 */
/* ── ═══════════════════════════════════════════════════════ ── */

.tendance-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
  margin-bottom: 24px;
  border-radius: var(--radius);
  overflow: hidden;
}
.tendance-table thead th {
  background: var(--navy);
  color: var(--white);
  padding: 11px 14px;
  text-align: center;
  font-weight: 600;
  font-size: 12px;
  letter-spacing: .5px;
}
.tendance-table thead th:first-child {
  text-align: left;
  background: var(--navy-dark);
  min-width: 170px;
}
.tendance-table tbody tr:nth-child(even) { background: var(--gray50); }
.tendance-table tbody td {
  padding: 9px 14px;
  border-bottom: 1px solid var(--gray100);
  text-align: center;
  color: var(--navy);
  vertical-align: middle;
}
.tendance-table td.row-label {
  text-align: left;
  font-weight: 600;
  font-size: 12px;
  color: var(--gray700);
}
.tendance-table td.val-highlight {
  font-weight: 700;
  color: var(--teal);
}
.tendance-table tr.separator-row td {
  background: rgba(44,51,64,.08);
  font-size: 10px;
  font-weight: 700;
  color: var(--navy-mid);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  padding: 6px 14px;
  text-align: left;
}
.tend-arrow {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 20px;
  margin-left: 6px;
  white-space: nowrap;
}
.tend-up   { background: rgba(34,134,58,.12);   color: #22863A; }
.tend-down { background: rgba(185,28,28,.10);   color: #B91C1C; }
.tend-flat { background: rgba(100,116,139,.12); color: #64748B; }
.tendance-chart-wrap {
  height: 280px;
  background: var(--white);
  border: 1px solid var(--gray100);
  border-radius: var(--radius);
  padding: 12px;
  margin-bottom: 20px;
}
.tendance-commentary {
  background: var(--ivory);
  border-left: 4px solid var(--teal);
  padding: 16px 20px;
  border-radius: 0 var(--radius) var(--radius) 0;
  font-size: 13px;
  color: var(--navy);
  line-height: 1.75;
}

/* ── ═══════════════════════════════════════════════════════ ── */
/*    PRINT                                                      */
/* ── ═══════════════════════════════════════════════════════ ── */

@media print {
  @page { margin: 15mm 12mm; size: A4; }

  body { background: white; font-size: 12px; }
  .no-print, .report-actions { display: none !important; }

  /* Supprime les overflow qui coupent le contenu aux sauts de page */
  .report-section,
  .ratio-card,
  .roe-card,
  .dupont-tree { overflow: visible !important; }

  /* Préservation couleurs d'arrière-plan */
  .report-header,
  .roe-card,
  .roe-card::before,
  .section-title,
  .ratio-card-header,
  .report-footer,
  .roe-badge,
  .ratio-level { -webkit-print-color-adjust: exact; print-color-adjust: exact; }

  /* Mise en page */
  .report-body { padding: 0; max-width: 100%; }
  .report-section {
    break-inside: avoid;
    box-shadow: none;
    border: 1px solid #ddd;
    margin-bottom: 14px;
  }

  /* Empêche les coupures à l'intérieur des blocs clés */
  .roe-card      { break-inside: avoid; }
  .ratio-card    { break-inside: avoid; }
  .chart-inner   { break-inside: avoid; }
  .method-item   { break-inside: avoid; }

  /* Arbre DuPont : réduit pour tenir sur la largeur A4 */
  .dupont-tree { padding: 16px 0; }
  .tree-wrap   { min-width: unset; width: 100%; transform: scale(0.82); transform-origin: top center; }

  /* Grilles */
  .ratios-grid { grid-template-columns: repeat(3, 1fr); gap: 10px; }
  .chart-inner { grid-template-columns: 1fr 1fr; padding: 16px; gap: 16px; }

  /* Hauteur graphique réduite pour éviter débordement */
  .chart-box        { height: 200px; }
  .chart-box canvas { max-height: 200px; }

  /* Footer */
  .report-footer { display: flex; }
}
