/* Formulaire fiche — simple */

.fiche-block {
  margin-bottom: 1.25rem;
  padding: 0;
}

.fiche-block + .fiche-block {
  border-top: none;
}

.fiche-block:first-child {
  padding-top: 0;
}

.fiche-block:last-of-type {
  padding-bottom: 0;
  margin-bottom: 0;
}

.fiche-block__title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  font-weight: 700;
  text-transform: uppercase;
  color: #212529;
  margin: 0 0 0.75rem;
}

.fiche-block__title::before {
  content: "";
  width: 4px;
  height: 1rem;
  border-radius: 2px;
  background: #007A4D;
  flex-shrink: 0;
}

.fiche-block .form-label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: #495057;
}

.fiche-block .form-control,
.fiche-block .form-select {
  font-size: 0.875rem;
  background: #f3f4f6;
  border: 1px solid #dee2e6;
  border-radius: 4px;
}

.fiche-block .form-control:focus,
.fiche-block .form-select:focus {
  background: #fff;
  border-color: #adb5bd;
  box-shadow: none;
}

.fiche-field[hidden] {
  display: none !important;
}

.fiche-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  padding-top: 1rem;
  margin-top: 0.5rem;
  border-top: 1px solid #dee2e6;
}

.fiche-form-actions .btn {
  min-width: 100px;
}

/* Vue fiche — affichage document */
.fiche-document {
  max-width: 100%;
}

.fiche-sheet {
  max-width: 210mm;
  margin: 0 auto 2rem;
  padding: 1.75rem;
  background: #fff;
  border: 1px solid #dee2e6;
  border-radius: 10px;
  box-shadow: 0 8px 30px rgba(26, 36, 33, 0.08);
}

.fiche-document .fiche-print-header {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas:
    "brand ref"
    "title title";
  gap: 0.85rem 1rem;
  align-items: start;
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 3px solid #007A4D;
}

.fiche-print-header__brand {
  grid-area: brand;
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.fiche-print-header__brand img {
  width: 56px;
  height: 56px;
  object-fit: contain;
  padding: 4px;
  background: #fff;
  border: 1px solid #dee2e6;
  border-radius: 6px;
}

.fiche-print-header__org {
  margin: 0;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #007A4D;
}

.fiche-print-header__country {
  margin: 0.2rem 0 0;
  font-size: 0.82rem;
  color: #495057;
}

.fiche-print-header__title {
  grid-area: title;
  text-align: center;
}

.fiche-print-header__title h1 {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #1a2421;
}

.fiche-print-header__title p {
  margin: 0.25rem 0 0;
  font-size: 0.85rem;
  color: #6c757d;
}

.fiche-print-header__ref {
  grid-area: ref;
  text-align: right;
  min-width: 130px;
  padding: 0.55rem 0.75rem;
  border: 1px solid #ced4da;
  border-radius: 6px;
  background: #f8f9fa;
}

.fiche-print-header__ref-label {
  display: block;
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #6c757d;
}

.fiche-print-header__ref strong {
  display: block;
  margin-top: 0.2rem;
  font-size: 0.85rem;
  color: #007A4D;
  word-break: break-all;
}

.fiche-document .fiche-print-footer {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 2px solid #007A4D;
}

.fiche-document .fiche-section-heading {
  margin: 0;
  padding: 0.55rem 0.85rem;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #fff;
  background: #007A4D;
  border: 1px solid #007A4D;
  border-bottom: none;
  border-radius: 6px 6px 0 0;
}

.fiche-document .fiche-summary-block {
  margin-bottom: 1.25rem;
}

.fiche-document .fiche-print-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  border: 1px solid #007A4D;
  border-top: none;
  border-radius: 0 0 6px 6px;
  overflow: hidden;
  background: #fff;
}

.fiche-print-summary__item {
  padding: 0.8rem 0.9rem;
  border-right: 1px solid #dee2e6;
  border-bottom: 1px solid #dee2e6;
  background: #fff;
}

.fiche-print-summary__item:nth-child(6n+1),
.fiche-print-summary__item:nth-child(6n+2),
.fiche-print-summary__item:nth-child(6n+3) {
  background: #fafcfb;
}

.fiche-print-summary__item:nth-child(3n) {
  border-right: none;
}

.fiche-print-summary__item:nth-last-child(1):nth-child(3n+1),
.fiche-print-summary__item:nth-last-child(1):nth-child(3n+2),
.fiche-print-summary__item:nth-last-child(2):nth-child(3n+1),
.fiche-print-summary__item:nth-last-child(3) {
  border-bottom: none;
}

.fiche-print-summary__label {
  display: block;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #007A4D;
  margin-bottom: 0.25rem;
}

.fiche-print-summary__value {
  display: block;
  font-size: 0.92rem;
  font-weight: 600;
  color: #1a2421;
  line-height: 1.35;
}

.fiche-document .fiche-print-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem 1.25rem;
  margin-bottom: 1.5rem;
  padding: 0.6rem 0.85rem;
  font-size: 0.8rem;
  color: #495057;
  border: 1px solid #dee2e6;
  border-left: 4px solid #007A4D;
  border-radius: 4px;
  background: #f8f9fa;
}

.fiche-document .fiche-print-meta strong {
  color: #1a2421;
  font-weight: 700;
}

.fiche-document .fiche-block {
  margin-bottom: 1.35rem;
}

.fiche-document .fiche-block__title {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin: 0;
  padding: 0.55rem 0.85rem;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #fff;
  background: #007A4D;
  border: 1px solid #007A4D;
  border-bottom: none;
  border-radius: 6px 6px 0 0;
}

.fiche-document .fiche-block__title::before {
  display: none;
}

.fiche-document .fiche-block__num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.65rem;
  height: 1.65rem;
  padding: 0 0.35rem;
  font-size: 0.68rem;
  font-weight: 800;
  color: #007A4D;
  background: #fff;
  border-radius: 4px;
  flex-shrink: 0;
}

.fiche-document .fiche-block__text {
  line-height: 1.3;
}

.fiche-document .fiche-block__body {
  border: 1px solid #007A4D;
  border-top: none;
  border-radius: 0 0 6px 6px;
  overflow: hidden;
}

.fiche-document .fiche-data-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 0;
  table-layout: fixed;
  background: #fff;
}

.fiche-document .fiche-data-table th,
.fiche-document .fiche-data-table td {
  border: 1px solid #ced4da;
  padding: 0.7rem 0.9rem;
  vertical-align: top;
  font-size: 0.875rem;
  line-height: 1.45;
}

.fiche-document .fiche-data-table tbody tr:nth-child(even) td {
  background: #fafcfb;
}

.fiche-document .fiche-data-table th {
  width: 18%;
  background: #eef2f0;
  color: #343a40;
  font-weight: 700;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.fiche-document .fiche-data-table td {
  width: 32%;
  color: #212529;
  background: #fff;
}

.fiche-document .fiche-data-table__value {
  font-weight: 500;
  color: #1a2421;
}

.fiche-document .fiche-data-table__row--wide .fiche-data-table__value {
  min-height: 3rem;
  white-space: pre-wrap;
}

.fiche-document .fiche-signatures {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  margin-bottom: 1rem;
}

.fiche-document .fiche-signatures__item {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.fiche-document .fiche-signatures__label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #495057;
}

.fiche-document .fiche-signatures__line {
  display: block;
  height: 2.75rem;
  border-bottom: 1px solid #495057;
}

.fiche-document .fiche-signatures__hint {
  font-size: 0.68rem;
  color: #adb5bd;
  font-style: italic;
}

.fiche-document .fiche-print-footer__legal {
  margin: 0 0 0.65rem;
  font-size: 0.72rem;
  line-height: 1.5;
  color: #6c757d;
  text-align: center;
  font-style: italic;
}

.fiche-document .fiche-print-footer__line {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.75rem;
  color: #495057;
}

@media (max-width: 767px) {
  .fiche-sheet {
    padding: 1rem;
    border-radius: 0;
    box-shadow: none;
    border: none;
  }

  .fiche-document .fiche-print-summary {
    grid-template-columns: 1fr;
  }

  .fiche-document .fiche-print-summary__item {
    border-right: none;
  }

  .fiche-document .fiche-print-summary__item:last-child {
    border-bottom: none;
  }

  .fiche-document .fiche-signatures {
    grid-template-columns: 1fr;
  }

  .fiche-document .fiche-data-table,
  .fiche-document .fiche-data-table tbody,
  .fiche-document .fiche-data-table tr,
  .fiche-document .fiche-data-table th,
  .fiche-document .fiche-data-table td {
    display: block;
    width: 100%;
  }

  .fiche-document .fiche-data-table tr {
    margin-bottom: 0.75rem;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    overflow: hidden;
  }

  .fiche-document .fiche-data-table th {
    border: none;
    border-bottom: 1px solid #dee2e6;
  }

  .fiche-document .fiche-data-table td {
    border: none;
  }

  .fiche-document .fiche-data-table td + th {
    border-top: 1px solid #dee2e6;
  }
}

@media (max-width: 575px) {
  .fiche-form-actions {
    flex-direction: column;
  }

  .fiche-form-actions .btn {
    width: 100%;
  }
}

/* Impression fiche — mise en page professionnelle */
@media print {
  @page {
    size: A4 portrait;
    margin: 14mm 12mm 18mm;
  }

  html,
  body {
    background: #fff !important;
    color: #1a2421 !important;
    font-family: "Inter", "Segoe UI", Arial, sans-serif !important;
    font-size: 9.5pt;
    line-height: 1.4;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .sidebar,
  .navbar,
  .footer,
  .admin-breadcrumb,
  .no-print,
  .pcsm-modal {
    display: none !important;
  }

  .wrapper,
  .main,
  .content,
  .container-fluid,
  .fiche-document,
  .fiche-sheet,
  .fiche-printable {
    display: block !important;
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
    float: none !important;
    box-shadow: none !important;
    border: none !important;
    border-radius: 0 !important;
  }

  .admin-page-title {
    display: none !important;
  }

  .fiche-document .fiche-print-header {
    display: grid !important;
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "brand ref"
      "title title";
    gap: 0.75rem 1rem;
    align-items: start;
    margin-bottom: 1rem;
    padding-bottom: 0.85rem;
    border-bottom: 3px solid #007A4D;
  }

  .fiche-print-header__brand {
    grid-area: brand;
    display: flex;
    align-items: center;
    gap: 0.75rem;
  }

  .fiche-print-header__brand img {
    width: 52px;
    height: 52px;
    object-fit: contain;
  }

  .fiche-print-header__org {
    margin: 0;
    font-size: 8pt;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #007A4D;
  }

  .fiche-print-header__country {
    margin: 0.15rem 0 0;
    font-size: 8.5pt;
    color: #495057;
  }

  .fiche-print-header__title {
    grid-area: title;
    text-align: center;
    padding-top: 0.15rem;
  }

  .fiche-print-header__title h1 {
    margin: 0;
    font-size: 15pt;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #1a2421;
  }

  .fiche-print-header__title p {
    margin: 0.2rem 0 0;
    font-size: 9pt;
    color: #6c757d;
  }

  .fiche-print-header__ref {
    grid-area: ref;
    text-align: right;
    min-width: 120px;
    padding: 0.45rem 0.65rem;
    border: 1px solid #ced4da;
    border-radius: 4px;
    background: #f8f9fa;
  }

  .fiche-print-header__ref-label {
    display: block;
    font-size: 7pt;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #6c757d;
  }

  .fiche-print-header__ref strong {
    display: block;
    margin-top: 0.15rem;
    font-size: 10pt;
    color: #007A4D;
    word-break: break-all;
  }

  .fiche-document .fiche-section-heading {
    padding: 0.35rem 0.55rem;
    font-size: 8pt;
    border-radius: 3px 3px 0 0;
  }

  .fiche-document .fiche-print-summary {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr);
    gap: 0;
    margin-bottom: 0.85rem;
    border: 1px solid #007A4D;
    border-top: none;
    border-radius: 0 0 3px 3px;
    overflow: hidden;
  }

  .fiche-document .fiche-print-summary__item {
    padding: 0.5rem 0.65rem;
    border-right: 1px solid #dee2e6;
    border-bottom: 1px solid #dee2e6;
    background: #fff !important;
  }

  .fiche-document .fiche-print-summary__item:nth-child(6n+1),
  .fiche-document .fiche-print-summary__item:nth-child(6n+2),
  .fiche-document .fiche-print-summary__item:nth-child(6n+3) {
    background: #fafcfb !important;
  }

  .fiche-document .fiche-print-summary__item:nth-child(3n) {
    border-right: none;
  }

  .fiche-document .fiche-print-summary__item:nth-last-child(1):nth-child(3n+1),
  .fiche-document .fiche-print-summary__item:nth-last-child(1):nth-child(3n+2),
  .fiche-document .fiche-print-summary__item:nth-last-child(2):nth-child(3n+1),
  .fiche-document .fiche-print-summary__item:nth-last-child(3) {
    border-bottom: none;
  }

  .fiche-document .fiche-print-summary__label {
    display: block;
    font-size: 7pt;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #007A4D;
    margin-bottom: 0.15rem;
  }

  .fiche-document .fiche-print-summary__value {
    display: block;
    font-size: 9pt;
    font-weight: 600;
    color: #1a2421;
  }

  .fiche-document .fiche-print-meta {
    display: flex !important;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
    padding: 0.35rem 0.5rem;
    font-size: 8pt;
    color: #6c757d !important;
    border: 1px solid #dee2e6;
    border-left: 3px solid #007A4D !important;
    background: #f8f9fa !important;
  }

  .fiche-document .fiche-block {
    break-inside: avoid;
    page-break-inside: avoid;
    margin: 0 0 0.85rem;
    padding: 0;
  }

  .fiche-document .fiche-block__title {
    margin: 0;
    padding: 0.35rem 0.55rem;
    font-size: 8pt;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #fff;
    background: #007A4D !important;
    border: 1px solid #007A4D;
    border-bottom: none;
    border-radius: 3px 3px 0 0;
  }

  .fiche-document .fiche-block__num {
    min-width: 1.4rem;
    height: 1.4rem;
    font-size: 7pt;
  }

  .fiche-document .fiche-block__body {
    border: 1px solid #007A4D;
    border-top: none;
    border-radius: 0 0 3px 3px;
  }

  .fiche-document .fiche-data-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    margin: 0;
  }

  .fiche-document .fiche-data-table th,
  .fiche-document .fiche-data-table td {
    border: 1px solid #adb5bd;
    padding: 0.38rem 0.5rem;
    font-size: 8.5pt;
    line-height: 1.35;
    vertical-align: top;
    word-wrap: break-word;
  }

  .fiche-document .fiche-data-table tbody tr:nth-child(even) td {
    background: #fafcfb !important;
  }

  .fiche-document .fiche-data-table th {
    width: 18%;
    background: #eef2f0 !important;
    color: #343a40 !important;
    font-weight: 600;
    font-size: 7.5pt;
    text-transform: uppercase;
    letter-spacing: 0.02em;
  }

  .fiche-document .fiche-data-table td {
    width: 32%;
    background: #fff !important;
    color: #1a2421 !important;
  }

  .fiche-document .fiche-data-table tr {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .fiche-document .fiche-signatures {
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 0.75rem;
  }

  .fiche-document .fiche-signatures__label {
    font-size: 7pt;
  }

  .fiche-document .fiche-signatures__line {
    height: 2.25rem;
  }

  .fiche-document .fiche-signatures__hint {
    font-size: 6.5pt;
  }

  .fiche-document .fiche-print-footer {
    display: block !important;
    margin-top: 1rem;
    padding-top: 0.65rem;
    border-top: 2px solid #007A4D;
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .fiche-document .fiche-print-footer__legal {
    margin: 0 0 0.45rem;
    font-size: 7pt;
    line-height: 1.45;
    color: #6c757d;
    text-align: center;
    font-style: italic;
  }

  .fiche-document .fiche-print-footer__line {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    font-size: 7.5pt;
    color: #495057;
  }

  a[href]::after {
    content: none !important;
  }
}
