:root {
  --rm-primary: #1e3a8a;
  --rm-primary-light: #2563eb;
  --docs-sidebar-width: 280px;
}

body.docs-portal,
body.docs-module {
  background-color: #f8f9fa;
}

body.docs-page {
  background-color: #f8f9fa;
  scroll-padding-top: 5.5rem;
}

body.docs-page.theme-fr {
  --rm-primary: #1e40af;
  --rm-primary-light: #2563eb;
}

.navbar-brand span { font-weight: 300; opacity: .85; }

.hero {
  background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 55%, #b45309 100%);
  color: #fff;
  /* Compense la navbar fixed-top Bootstrap (~56px) */
  padding: 5.5rem 0 3rem;
}
.hero h1 { font-weight: 700; }
.hero p { opacity: .92; max-width: 42rem; }
.hero .breadcrumb-item + .breadcrumb-item::before {
  color: rgba(255, 255, 255, 0.55);
}
.hero .breadcrumb-item.active {
  color: #fff;
}
.hero .breadcrumb-item a.text-white-50:hover {
  color: #fff !important;
}

.portal-grid .card,
.module-grid .card {
  border: none;
  box-shadow: 0 .125rem .25rem rgba(0,0,0,.06);
  transition: transform .15s ease, box-shadow .15s ease;
  height: 100%;
}
.portal-grid .card:hover,
.module-grid .card:hover {
  transform: translateY(-2px);
  box-shadow: 0 .35rem .75rem rgba(0,0,0,.1);
}

.toc-card { position: sticky; top: 5.5rem; }
.toc-card .nav-link {
  color: #495057;
  padding: .35rem 0;
  font-size: .925rem;
}
.toc-card .nav-link:hover { color: var(--rm-primary-light); }

.section-card {
  border: none;
  box-shadow: 0 .125rem .25rem rgba(0,0,0,.06);
  margin-bottom: 1.25rem;
}
.section-card .card-header {
  background: #fff;
  border-bottom: 1px solid #e9ecef;
  font-weight: 600;
  font-size: 1.15rem;
  padding: 1rem 1.25rem;
}

.step-card {
  border-left: 4px solid var(--rm-primary-light);
  background: #f0f4ff;
}
.step-badge {
  width: 2.25rem;
  height: 2.25rem;
  background: var(--rm-primary-light);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  flex-shrink: 0;
}

.photo-placeholder {
  border: 2px dashed #adb5bd;
  border-radius: .5rem;
  background: #f8f9fa;
  padding: 1.25rem;
  text-align: center;
  color: #6c757d;
}
.photo-placeholder.has-image {
  border-style: solid;
  border-color: #dee2e6;
  background: #fff;
  padding: .75rem;
}
.photo-placeholder img {
  max-width: 100%;
  height: auto;
  border-radius: .375rem;
  box-shadow: 0 .25rem .5rem rgba(0,0,0,.08);
}
.photo-caption {
  font-size: .85rem;
  color: #6c757d;
  margin-top: .75rem;
  margin-bottom: 0;
}
.photo-label {
  font-weight: 600;
  color: #495057;
  display: block;
  margin-bottom: .5rem;
}
.photo-hint {
  font-size: .8rem;
  font-style: italic;
  color: #868e96;
  margin-top: .5rem;
}

.flow-box {
  background: #111827;
  color: #e5e7eb;
  padding: 1rem 1.25rem;
  border-radius: 8px;
  font-size: .95rem;
  white-space: pre-wrap;
}

.menu-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: .75rem;
  margin: 1rem 0;
}
.menu-item {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: .85rem 1rem;
  background: #fafafa;
}
.menu-item strong { display: block; margin-bottom: .25rem; }

ol.steps-list li { margin-bottom: .5rem; }

.breadcrumb a { text-decoration: none; }

.print-toc { display: none; }

@media print {
  @page { size: A4 portrait; margin: 16mm 14mm 18mm 14mm; }

  html, body {
    background: #fff !important;
    color: #111 !important;
    font-size: 10.5pt;
    line-height: 1.45;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .no-print { display: none !important; }

  .print-toc {
    display: block !important;
    page-break-after: always;
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 1rem 1.25rem;
    margin-bottom: 0;
  }
  .print-toc h2 { font-size: 13pt; margin: 0 0 .75rem; color: var(--rm-primary); }
  .print-toc ol { margin: 0; padding-left: 1.25rem; columns: 2; column-gap: 2rem; }
  .print-toc li { margin-bottom: .35rem; break-inside: avoid; }

  .hero {
    background: #1e3a8a !important;
    padding: 1.25rem 0 !important;
    page-break-after: avoid;
  }
  .hero .display-5 { font-size: 22pt; }
  .hero .lead { font-size: 11pt; }

  .container-lg { max-width: 100% !important; width: 100% !important; padding-top: 0 !important; padding-bottom: 0 !important; }
  main.col-lg-9 { width: 100% !important; max-width: 100% !important; flex: 0 0 100% !important; padding: 0 !important; }

  .section-card {
    box-shadow: none !important;
    border: 1px solid #bbb !important;
    border-radius: 4px !important;
    margin-bottom: 8mm !important;
  }
  .section-card .card-header {
    background: #eef2ff !important;
    border-bottom: 1px solid #bbb !important;
    font-size: 12pt;
    padding: .6rem .85rem !important;
    page-break-after: avoid;
  }

  #etape1, #etape2, #etape3 { page-break-before: always; }
  #avant { page-break-before: always; }

  .alert { border: 1px solid #999 !important; page-break-inside: avoid; }
  .step-card { page-break-inside: avoid; }
  figure.photo-placeholder { page-break-inside: avoid; break-inside: avoid; }
  figure.photo-placeholder img { box-shadow: none !important; max-height: 95mm; object-fit: contain; display: block; margin: 0 auto; }
  .table { page-break-inside: avoid; font-size: 9.5pt; }
  a[href^="#"]::after { content: none !important; }
}
