/* OAFormation — Suite Simulateurs CHR — styles communs (préfixe .oaf-sim) */
.oaf-sim {
  --oaf-primary: #1a2b49;
  --oaf-accent: #d97706;
  --oaf-accent-dark: #b45309; /* fond des boutons : contraste 5:1 avec le blanc (AA) */
  --oaf-bg: #f8fafc;
  --oaf-card: #ffffff;
  --oaf-border: #e2e8f0;
  --oaf-text: #1e293b;
  --oaf-muted: #64748b;
  max-width: 780px;
  margin: 2rem auto;
  background: var(--oaf-card);
  border: 1px solid var(--oaf-border);
  border-radius: 14px;
  box-shadow: 0 10px 25px -5px rgba(15, 23, 42, .08);
  overflow: hidden;
  color: var(--oaf-text);
  font-family: inherit;
  line-height: 1.55;
}
.oaf-sim *, .oaf-sim *::before, .oaf-sim *::after { box-sizing: border-box; }
.oaf-sim__header { background: var(--oaf-primary); color: #fff; padding: 1.5rem 1.75rem; border-bottom: 4px solid var(--oaf-accent); }
.oaf-sim__badge { display: inline-block; background: rgba(255,255,255,.15); color: #fde68a; font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; padding: .25rem .65rem; border-radius: 999px; margin: 0 0 .5rem; }
.oaf-sim__header .oaf-sim__title { margin: 0 0 .35rem; font-size: 1.4rem; line-height: 1.3; color: #fff; }
.oaf-sim__intro { margin: 0; font-size: .95rem; color: #e2e8f0; }
.oaf-sim__progress { background: var(--oaf-border); height: 6px; }
.oaf-sim__bar { background: var(--oaf-accent); height: 100%; width: 0; transition: width .3s ease; }
.oaf-sim__body { padding: 1.75rem; }
.oaf-sim__step { font-size: .82rem; font-weight: 700; text-transform: uppercase; color: var(--oaf-accent-dark); letter-spacing: .04em; margin: 0 0 .4rem; }
.oaf-sim__question { font-size: 1.2rem; color: var(--oaf-primary); margin: 0 0 .4rem; }
.oaf-sim__question:focus { outline: none; }
.oaf-sim__question:focus-visible { outline: 3px solid var(--oaf-accent); outline-offset: 4px; }
.oaf-sim__hint { font-size: .92rem; color: var(--oaf-muted); margin: 0 0 1.25rem; }
.oaf-sim__options { display: grid; gap: .75rem; }
.oaf-sim__opt { display: block; width: 100%; text-align: left; background: var(--oaf-bg); border: 2px solid var(--oaf-border); border-radius: 10px; padding: 1rem 1.15rem; min-height: 44px; cursor: pointer; color: var(--oaf-text); font: inherit; transition: border-color .2s, background .2s; }
.oaf-sim__opt:hover { border-color: var(--oaf-accent); background: #fffbeb; }
.oaf-sim__opt:focus-visible, .oaf-sim__btn:focus-visible, .oaf-sim__link:focus-visible, .oaf-sim a:focus-visible, .oaf-sim summary:focus-visible { outline: 3px solid var(--oaf-primary); outline-offset: 2px; }
.oaf-sim__opt-title { display: block; font-weight: 700; color: var(--oaf-primary); margin-bottom: .15rem; }
.oaf-sim__opt-desc { display: block; font-size: .88rem; color: var(--oaf-muted); }
.oaf-sim__nav { margin-top: 1.25rem; }
.oaf-sim__link { background: none; border: 0; color: var(--oaf-primary); text-decoration: underline; font: inherit; font-size: .92rem; cursor: pointer; padding: .5rem 0; min-height: 44px; }
.oaf-sim__grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-bottom: 1rem; }
@media (max-width: 640px) { .oaf-sim__grid { grid-template-columns: 1fr; } .oaf-sim__body { padding: 1.25rem; } }
.oaf-sim__card { background: #fff; border: 1px solid var(--oaf-border); border-left: 4px solid var(--oaf-primary); border-radius: 8px; padding: 1rem; }
.oaf-sim__card--formation { border-left-color: var(--oaf-accent); }
.oaf-sim__label { font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--oaf-muted); margin: 0 0 .35rem; }
.oaf-sim__value { font-weight: 800; color: var(--oaf-primary); margin: 0 0 .2rem; }
.oaf-sim__duree { font-size: .9rem; font-weight: 600; margin: 0 0 .2rem; }
.oaf-sim__sub { font-size: .88rem; color: var(--oaf-muted); margin: 0 0 .3rem; }
.oaf-sim__formations { list-style: none; margin: 0; padding: 0; }
.oaf-sim__formations li + li { border-top: 1px solid var(--oaf-border); margin-top: .75rem; padding-top: .75rem; }
.oaf-sim__inline-link { font-size: .88rem; color: var(--oaf-primary); }
.oaf-sim__alert { border-left: 4px solid #f59e0b; background: #fffbeb; color: #78350f; padding: .9rem 1rem; border-radius: 6px; font-size: .92rem; margin-bottom: .75rem; }
.oaf-sim__alert--info { border-left-color: var(--oaf-primary); background: var(--oaf-bg); color: var(--oaf-text); }
.oaf-sim__h { font-size: 1rem; color: var(--oaf-primary); margin: 1.25rem 0 .5rem; }
.oaf-sim__checklist { margin: 0 0 1rem; padding-left: 1.3rem; font-size: .93rem; }
.oaf-sim__checklist li { margin-bottom: .45rem; }
.oaf-sim__cta { display: flex; flex-wrap: wrap; gap: .75rem; margin: 1.25rem 0 .75rem; }
.oaf-sim .oaf-sim__cta-main { flex: 1 1 280px; display: inline-block; background: var(--oaf-accent-dark); color: #fff; text-decoration: none; font-weight: 700; padding: .9rem 1.4rem; border-radius: 8px; text-align: center; }
.oaf-sim .oaf-sim__cta-main:hover { background: #92400e; color: #fff; }
.oaf-sim .oaf-sim__cta-second { flex: 0 1 auto; display: inline-block; border: 2px solid var(--oaf-primary); color: var(--oaf-primary); text-decoration: none; font-weight: 700; padding: .8rem 1.2rem; border-radius: 8px; text-align: center; }
.oaf-sim__actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.oaf-sim__btn { background: #fff; border: 1px solid #94a3b8; color: var(--oaf-primary); font: inherit; font-size: .9rem; font-weight: 600; padding: .6rem 1rem; min-height: 44px; border-radius: 8px; cursor: pointer; }
.oaf-sim__btn:hover { background: #f1f5f9; }
.oaf-sim__details { margin-top: 1rem; font-size: .88rem; }
.oaf-sim__details summary { cursor: pointer; color: var(--oaf-primary); font-weight: 600; }
.oaf-sim__sources { padding-left: 1.2rem; }
.oaf-sim__disclaimer, .oaf-sim__mention { font-size: .8rem; color: var(--oaf-muted); margin: .75rem 0 0; }
.oaf-sim__sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
@media (prefers-reduced-motion: reduce) { .oaf-sim__bar, .oaf-sim__opt { transition: none; } }

/* Impression A4 : seul le simulateur ciblé est imprimé */
@media print {
  @page { size: A4; margin: 15mm; }
  html.oaf-sim-printing body * { visibility: hidden; }
  html.oaf-sim-printing .oaf-sim--print-target, html.oaf-sim-printing .oaf-sim--print-target * { visibility: visible; }
  html.oaf-sim-printing .oaf-sim--print-target { position: absolute; left: 0; top: 0; width: 100%; }
  .oaf-sim { box-shadow: none; border: 0; max-width: none; margin: 0; }
  .oaf-sim__noprint, .oaf-sim__progress { display: none !important; }
  .oaf-sim__details > *:not(summary) { display: block; }
  .oaf-sim a[href^="http"]::after { content: " (" attr(href) ")"; font-size: .75em; color: #475569; word-break: break-all; }
  .oaf-sim__card, .oaf-sim__alert { break-inside: avoid; }
}

/* ---------- Formulaires (rétroplanning, rentabilité) ---------- */
.oaf-sim__fieldset { border: 1px solid var(--oaf-border); border-radius: 10px; padding: 1rem 1.1rem 1.2rem; margin: 0 0 1.25rem; }
.oaf-sim__fieldset legend { font-weight: 800; color: var(--oaf-primary); padding: 0 .4rem; }
.oaf-sim__grid3 { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: .85rem 1rem; }
.oaf-sim__field label { display: block; font-weight: 600; font-size: .9rem; color: var(--oaf-text); margin-bottom: .25rem; }
.oaf-sim__unit { font-weight: 400; color: var(--oaf-muted); }
.oaf-sim__field input, .oaf-sim__field select { width: 100%; min-height: 44px; padding: .5rem .65rem; border: 1px solid #94a3b8; border-radius: 6px; font: inherit; color: var(--oaf-text); background: #fff; }
.oaf-sim__field input:focus-visible, .oaf-sim__field select:focus-visible, .oaf-sim__check input:focus-visible { outline: 3px solid var(--oaf-accent); outline-offset: 1px; }
.oaf-sim__field input[aria-invalid="true"] { border-color: #b91c1c; border-width: 2px; }
.oaf-sim__field .oaf-sim__sub { margin: .1rem 0 .3rem; font-size: .8rem; }
.oaf-sim__checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: .4rem 1rem; margin: 1rem 0; }
.oaf-sim__check { display: flex; align-items: flex-start; gap: .55rem; min-height: 44px; padding: .25rem 0; }
.oaf-sim__check input { width: 22px; height: 22px; margin-top: .1rem; flex-shrink: 0; accent-color: var(--oaf-primary); }
.oaf-sim__check label { font-size: .92rem; cursor: pointer; }
.oaf-sim .oaf-sim__submit { border: 0; cursor: pointer; font: inherit; font-weight: 700; }
.oaf-sim__section { border: 1px solid var(--oaf-border); border-radius: 10px; margin: 0 0 1rem; background: #fff; }
.oaf-sim__section > summary { cursor: pointer; padding: .9rem 1.1rem; font-weight: 800; color: var(--oaf-primary); min-height: 44px; }
.oaf-sim__section > *:not(summary) { margin-left: 1.1rem; margin-right: 1.1rem; }
.oaf-sim__section > *:last-child { margin-bottom: 1.1rem; }
.oaf-sim__rows { margin-bottom: 1rem; }
.oaf-sim__row { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: .5rem .75rem; align-items: end; padding: .6rem 0; border-bottom: 1px dashed var(--oaf-border); }
.oaf-sim__out { margin-top: 1.5rem; }

/* ---------- Tableau de bord ---------- */
.oaf-sim__tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .6rem; margin: 1rem 0; }
.oaf-sim__tile { background: var(--oaf-bg); border: 1px solid var(--oaf-border); border-top: 4px solid var(--oaf-primary); border-radius: 8px; padding: .7rem .8rem; }
.oaf-sim__tile.is-bad { border-top-color: #b91c1c; } .oaf-sim__tile.is-warn { border-top-color: var(--oaf-accent); } .oaf-sim__tile.is-ok { border-top-color: #047857; }
.oaf-sim__tile-v { display: block; font-size: 1.2rem; font-weight: 800; color: var(--oaf-primary); }
.oaf-sim__tile-l { display: block; font-size: .8rem; color: var(--oaf-muted); }
.oaf-sim__meter { background: var(--oaf-border); height: 14px; border-radius: 999px; overflow: hidden; }
.oaf-sim__meter-bar { background: #047857; height: 100%; }
.oaf-sim__toolbar { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: .6rem 1rem; align-items: end; margin: 1rem 0 .5rem; padding: .8rem; background: var(--oaf-bg); border-radius: 8px; }
.oaf-sim__toolbar button[aria-pressed="true"] { background: var(--oaf-primary); color: #fff; }

/* ---------- Tâches ---------- */
.oaf-sim__tasklist { list-style: none; margin: 0; padding: 0; }
.oaf-sim__task { border: 1px solid var(--oaf-border); border-left: 4px solid var(--oaf-primary); border-radius: 8px; padding: .75rem .9rem; margin-bottom: .6rem; break-inside: avoid; }
.oaf-sim__task.is-done { border-left-color: #047857; opacity: .8; }
.oaf-sim__task.is-done .oaf-sim__task-head label { text-decoration: line-through; }
.oaf-sim__task-head { display: flex; gap: .6rem; align-items: flex-start; }
.oaf-sim__task-head input { width: 24px; height: 24px; margin-top: .1rem; flex-shrink: 0; accent-color: #047857; }
.oaf-sim__task-head label { font-weight: 700; color: var(--oaf-primary); cursor: pointer; }
.oaf-sim__task-meta { display: flex; flex-wrap: wrap; gap: .35rem; margin: .45rem 0 .25rem; }
.oaf-sim__badge2 { font-size: .75rem; font-weight: 600; border: 1px solid #94a3b8; color: #334155; border-radius: 999px; padding: .1rem .55rem; }
.oaf-sim__badge2.is-strong { border-color: var(--oaf-primary); color: var(--oaf-primary); }
.oaf-sim__badge2.is-bad { border-color: #b91c1c; color: #991b1b; background: #fef2f2; }
.oaf-sim__badge2.is-warn { border-color: #b45309; color: #92400e; background: #fffbeb; }
.oaf-sim__badge2.is-ok { border-color: #047857; color: #065f46; background: #ecfdf5; }
.oaf-sim__task-dates { font-weight: 700; font-size: .9rem; margin: .2rem 0; }

/* ---------- Résultats financiers ---------- */
.oaf-sim__dl { display: grid; grid-template-columns: minmax(180px, 34%) 1fr; gap: .45rem 1rem; font-size: .92rem; }
.oaf-sim__dl dt { font-weight: 600; } .oaf-sim__dl dd { margin: 0; }
@media (max-width: 640px) { .oaf-sim__dl { grid-template-columns: 1fr; } .oaf-sim__dl dd { margin-bottom: .5rem; } }
.oaf-sim__charts { display: grid; grid-template-columns: 1fr; gap: 1rem; }
.oaf-sim__figure { margin: 0; border: 1px solid var(--oaf-border); border-radius: 10px; padding: .75rem; break-inside: avoid; }
.oaf-sim__figure figcaption { margin-top: 0; }
.oaf-sim__chart { width: 100%; max-width: 620px; height: auto; display: block; }
.oaf-sim__tablewrap { overflow-x: auto; }
.oaf-sim__table { width: 100%; border-collapse: collapse; font-size: .9rem; margin: .5rem 0; }
.oaf-sim__table th, .oaf-sim__table td { border-bottom: 1px solid var(--oaf-border); padding: .45rem .5rem; text-align: left; }
.oaf-sim__table td { text-align: right; } .oaf-sim__table thead th { background: var(--oaf-bg); }

/* ---------- Page hub ---------- */
.oaf-sim__hub { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; }
.oaf-sim__hub .oaf-sim__card { display: flex; flex-direction: column; gap: .4rem; }
.oaf-sim__hub .oaf-sim__cta-main { margin-top: auto; }

@media print {
  .oaf-sim__toolbar, .oaf-sim__section > summary::marker { display: none !important; }
  .oaf-sim__field input, .oaf-sim__field select { border: 0; padding: 0; min-height: 0; }
  .oaf-sim__task, .oaf-sim__figure, .oaf-sim__tile { break-inside: avoid; }
}
