/* ==========================
   REÇU ENCAISSEMENT (ÉCRAN)
   ========================== */

.recu-host {
  display: flex;
  justify-content: center;
  padding: 0;
}

/* Aperçu fidèle au format A6 portrait */
.recu-paper {
  width: min(105mm, calc(100vw - 2rem));
  min-height: 148mm;
  background: #fff;
  border: 1px solid #d9e2ec;
  border-radius: 12px;
  padding: 6mm 5.5mm;
  margin: 0 auto;
  box-sizing: border-box;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.10);
  font-size: 12px;
  line-height: 1.35;
  color: #14213d;
}

body:not(:has(.login-page)) .app-page-shell > main .recu-host,
body:not(:has(.login-page)) .app-page-shell > main #recap-encaissement {
  zoom: var(--app-user-zoom-inverse, 1) !important;
}

.recu-modal .modal-dialog.recu-modal-dialog {
  width: min(128mm, calc(100vw - 1rem));
  max-width: min(128mm, calc(100vw - 1rem));
  margin: 1rem auto;
}

.recu-modal .modal-content {
  border: 1px solid #dbe4ee;
  border-radius: 18px;
  overflow: hidden;
}

.recu-modal .modal-header {
  padding: 0.7rem 1rem !important;
}

.recu-modal .modal-title {
  font-size: 1rem !important;
  line-height: 1.2;
  font-weight: 800;
}

.recu-modal .modal-body {
  padding: 0.75rem !important;
  background: linear-gradient(180deg, #f8fbff 0%, #eef4fb 100%);
  max-height: calc(100vh - 9.25rem);
  overflow: auto;
  overscroll-behavior: contain;
}

.recu-modal .modal-footer {
  padding: 0.65rem 1rem !important;
}

.recu-modal .modal-footer .btn {
  min-height: 2.35rem;
  padding: 0.45rem 0.8rem;
  font-size: 0.92rem;
  font-weight: 800;
}

.recu-modal .recu-host {
  zoom: 0.88;
  align-items: flex-start;
}

@media (max-height: 820px) {
  .recu-modal .recu-host {
    zoom: 0.8;
  }
}

.recu-header {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid #e8edf3;
}

.recu-logo img{
  height: 26px;
  width: auto;
}

.recu-header-text {
  flex: 1;
  text-align: left;
}

.recu-header-topline {
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #6a7a90;
}

.recu-school-name {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .03em;
  text-transform: uppercase;
  color: #0f3d91;
}



.recu-receipt-id {
  font-size: 12px;
  font-weight: 600;
  color: #182b52;
}

.recu-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  font-size: 10px;
  color: #526277;
}

.recu-chip {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.12rem 0.45rem;
  font-size: 9px;
  font-weight: 800;
}

.recu-chip--origin {
  background: #edf3fa;
  color: #28415d;
}

.recu-chip--scolarite {
  background: #e8f6ee;
  color: #157347;
}

.recu-chip--manuels {
  background: #e8f6fb;
  color: #0b7394;
}

.recu-chip--transport {
  background: #fff2da;
  color: #935b0d;
}

.recu-highlight {
  margin-bottom: 8px;
  padding: 8px 9px;
  border: 1px solid #dce7f2;
  border-radius: 12px;
  background: linear-gradient(180deg, #f9fbff 0%, #f0f5fc 100%);
  text-align: center;
}

.recu-highlight__label {
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #6a7a90;
}

.recu-highlight__value {
  font-size: 19px;
  font-weight: 900;
  line-height: 1.1;
  color: #18325e;
}

.recu-highlight__meta {
  margin-top: 2px;
  font-size: 9px;
  font-weight: 700;
  color: #45617f;
}

.recu-card {
  overflow: hidden;
}

.recu-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.recu-detail-item {
  padding: 6px 7px;
  border: 1px solid #e6edf5;
  border-radius: 10px;
  background: #fbfdff;
}

.recu-detail-item--wide {
  grid-column: 1 / -1;
}

.recu-detail-item__label {
  display: block;
  margin-bottom: 2px;
  font-size: 8px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #6a7a90;
}

.recu-detail-item__value {
  display: block;
  font-size: 10px;
  font-weight: 700;
  color: #162740;
}

.recu-section-title {
  font-weight: 800;
  color: #1f365a;
  background: linear-gradient(180deg, #f8fbff 0%, #f1f6fc 100%);
}

.recu-section-title--scolarite {
  color: #155d39;
  background: linear-gradient(180deg, #ecf8f1 0%, #e4f3ea 100%);
}

.recu-section-title--manuels {
  color: #0b7394;
  background: linear-gradient(180deg, #ecf8fc 0%, #e3f3f9 100%);
}

.recu-section-title--transport {
  color: #8a580e;
  background: linear-gradient(180deg, #fff6e7 0%, #fff0d1 100%);
}

.recu-stat-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 7px;
}

.recu-stat {
  padding: 6px 7px;
  border: 1px solid #e4ecf5;
  border-radius: 10px;
  background: #fbfdff;
}

.recu-stat__label {
  display: block;
  margin-bottom: 2px;
  font-size: 8px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #6a7a90;
}

.recu-stat__value {
  display: block;
  font-size: 10px;
  font-weight: 800;
  color: #162740;
}

.recu-tier-list {
  display: grid;
  gap: 4px;
}

.recu-tier-badge {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.05fr);
  gap: 3px 6px;
  padding: 4px 6px;
  border-radius: 8px;
  background: #f7fafc;
  color: #162740;
  white-space: normal;
  overflow: hidden;
  overflow-wrap: anywhere;
}

.recu-tier-badge span {
  min-width: 0;
  line-height: 1.18;
}

.recu-tier-badge b {
  display: block;
  font-size: 0.82em;
  font-weight: 800;
  color: #6a7a90;
}

.recu-transport-block {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px dashed #e5ecf4;
}

.recu-transport-block:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

.recu-footer {
  font-size: 9px;
}

.recu-contact-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 2px 8px;
  margin-top: auto;
  padding-top: 5px;
  border-top: 1px solid #e6edf5;
  color: #526277;
  font-size: 7.5px;
  line-height: 1.2;
  text-align: center;
}

.recu-contact-footer span {
  overflow-wrap: anywhere;
}
.badge-small {
  font-size: 0.5rem;
  padding: 0.10rem 0.25rem;
}


/* Paires clé/valeur alignées proprement */
/* Paires clé/valeur alignées proprement */
.kv2 {
  display: block;
}

.kv {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  border-bottom: 1px dashed #e7edf5;
  padding: 3px 0;
}

.kv .k {
  font-weight: 600;
  text-align: left;
  white-space: nowrap;
  flex: 0 0 auto;
  color: #4a5a70;
}

.kv .v {
  flex: 1 1 auto;
  text-align: right;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 999px;
  color: #122033;
  font-weight: 600;
}


/* Cartes compactes */

.card {
  border-radius: 10px;
  border: 1px solid #e6ecf3;
  box-shadow: none !important;
}

.card-body {
  padding: .4rem .45rem !important;
}

.card-header {
  padding: .35rem .45rem !important;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

/* Barre de progression */

.recu-progress {
  height: 10px;
  position: relative;
}

.recu-progress .progress-bar {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.recu-progress .progress-label {
  font-size: 9px;
  line-height: 1;
  color: #fff;
  mix-blend-mode: normal;
}



/* Texte tiers */

.tiers {
  font-size: 10px;
  line-height: 1.2;
}

/* ==========================
   IMPRESSION
   ========================== */
@media print {

  body:has(#recap-encaissement) .app-page-shell > main {
    zoom: 1 !important;
  }

  .recu-host,
  #recap-encaissement {
    zoom: 1 !important;
  }

  @page {
    size: A6 portrait;      /* 105mm x 148mm */
    margin: 0;
  }

  html, body {
    margin: 0 !important;
    padding: 0 !important;
    background: #fff !important;
    height: auto !important;
    overflow: visible !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  /* Cache tout sauf la modale */
  body > *:not(#recapModal) {
    display: none !important;
  }

  /* Cache le header "Récapitulatif..." + footer boutons */
  #recapModal .modal-header,
  #recapModal .modal-footer {
    display: none !important;
  }

  /* Affiche la chaîne de la modale */
  #recapModal,
  #recapModal .modal-dialog,
  #recapModal .modal-content,
  #recapModal .modal-body,
  #recapModalBody,
  #recap-encaissement,
  #recap-encaissement * {
    visibility: visible !important;
  }

  #recapModal {
    position: static !important;
    inset: auto !important;
    display: block !important;
    width: 105mm !important;
    height: 148mm !important;
    min-height: 148mm !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
    transform: none !important;
    background: #fff !important;
  }

  /* IMPORTANT: virer les contraintes bootstrap qui coupent */
  #recapModal .modal-dialog {
    margin: 0 !important;
    max-width: none !important;
    width: 105mm !important;
    min-height: 148mm !important;
    height: 148mm !important;
    display: block !important;
    align-items: stretch !important;
    transform: none !important;
  }

  #recapModal .modal-content {
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    background: #fff !important;
    width: 105mm !important;
    min-height: 148mm !important;
    height: 148mm !important;
    overflow: visible !important;
  }

  #recapModal .modal-body {
    padding: 0 !important;
    display: block !important;
    background: #fff !important;
    width: 105mm !important;
    max-height: none !important;
    min-height: 0 !important;
    height: 148mm !important;
    overflow: visible !important;
  }

  #recapModalBody,
  .recu-host {
    display: block !important;
    width: 105mm !important;
    height: 148mm !important;
    min-height: 148mm !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
    transform: none !important;
  }

  /* Pas d'overlay */
  .modal-backdrop {
    display: none !important;
  }

  /* Le reçu = seule page */
  #recap-encaissement {
    display: flex !important;
    flex-direction: column !important;
    width: 105mm !important;
    height: 148mm !important;
    min-height: 148mm !important;
    page-break-after: avoid !important;
    break-after: avoid !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }

  /* Reset du papier */
  .recu-paper {
    display: flex !important;
    flex-direction: column !important;
    width: 105mm !important;
    min-height: 148mm !important;
    height: 148mm !important;
    margin: 0 !important;
    padding: 4mm 4.5mm 3.5mm !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    font-size: 9.4px !important;
    line-height: 1.2 !important;
    overflow: hidden !important;
  }

  /* Evite que certains blocs forcent une 2e page */
  .card, .card-body, .progress, .tiers {
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }

  .recu-paper > .recu-card:last-of-type {
    flex: 1 1 auto !important;
    display: flex !important;
    flex-direction: column !important;
    min-height: 0 !important;
  }

  .recu-paper > .recu-card:last-of-type > .card-body {
    flex: 1 1 auto !important;
    display: flex !important;
    flex-direction: column !important;
    min-height: 0 !important;
  }

  /* Optionnel: compacter un peu les marges/paddings bootstrap */
  .card-body { padding: .14rem .2rem !important; }
  .card-header { padding: .14rem .2rem !important; }
  .recu-card { margin-bottom: 2.5px !important; }
  .recu-header { margin-bottom: 3px !important; padding-bottom: 3px !important; }
  .recu-school-name { font-size: 8px !important; }
  .recu-receipt-id { font-size: 10px !important; }
  .recu-meta { font-size: 8px !important; }
  .recu-highlight { padding: 4px 6px !important; margin-bottom: 2.5px !important; }
  .recu-highlight__label { font-size: 7px !important; }
  .recu-highlight__value { font-size: 13px !important; }
  .recu-highlight__meta { font-size: 8px !important; }
  .recu-detail-grid,
  .recu-stat-grid { gap: 3px !important; margin-bottom: 3px !important; }
  .recu-detail-item,
  .recu-stat { padding: 3px 4px !important; }
  .recu-detail-item__label,
  .recu-stat__label { font-size: 7px !important; }
  .recu-detail-item__value,
  .recu-stat__value,
  .recu-tier-badge { font-size: 8px !important; }
  .recu-tier-badge {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.05fr) !important;
    gap: 1px 3px !important;
    padding: 2px 3px !important;
    overflow-wrap: anywhere !important;
  }
  .recu-tier-list {
    flex: 1 1 auto !important;
    display: grid !important;
    grid-template-rows: repeat(4, minmax(0, 1fr)) !important;
    align-content: stretch !important;
  }
  .recu-tier-list > div {
    display: flex !important;
    min-height: 0 !important;
  }
  .recu-tier-list .recu-tier-badge {
    flex: 1 1 auto !important;
    align-items: center !important;
  }
  .recu-tier-badge b {
    font-size: 6.5px !important;
  }
  .kv { padding: 2px 0 !important; gap: 4px !important; }
  .kv .k,
  .kv .v,
  .tiers { font-size: 7.8px !important; gap: 2px !important; }
  .recu-progress {
    height: 8px !important;
    margin: 2px 0 !important;
    overflow: visible !important;
  }
  .recu-progress .progress-bar {
    position: static !important;
  }
  .recu-progress .progress-label {
    position: absolute !important;
    inset: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    color: #ffffff !important;
    font-size: 7px !important;
    font-weight: 800 !important;
    line-height: 1 !important;
    text-align: center !important;
  }
  .recu-footer {
    font-size: 7.5px !important;
    margin-top: auto !important;
    padding-top: 3px !important;
  }

  .recu-contact-footer {
    gap: 1px 5px !important;
    padding-top: 2px !important;
    font-size: 5.8px !important;
    line-height: 1.08 !important;
    max-height: 15mm !important;
    overflow: hidden !important;
  }

}
