.mx .ent-page:not(:has(> .mx-barre)) { padding-top: 60px; }
.mx .ent-page { overflow-wrap: anywhere; }
.mx .ent-page .demo-home a { max-width: 100%; }
.mx .ent-page [hidden] { display: none; }
.mx .ent-page-contenu { gap: 14px; padding-top: 0; }
.mx .ent-tete { padding: 0; }
.mx .ent-tete p { margin-top: 2px; }

.ent-colonnes {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}
.mx .ent-sommaire { padding: 8px 0; }
.ent-identite-mobile, .ent-retour { display: none; }
.ent-ligne {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) 20px;
  align-items: center;
  gap: 12px;
  padding: 8px 16px;
  min-height: 58px;
  border-top: 1px solid var(--trait);
  box-sizing: border-box;
  color: var(--encre);
  text-decoration: none;
  overflow-wrap: anywhere;
}
.ent-ligne:first-child { border-top: 0; }
.ent-ligne[aria-current] { background: var(--route-pale); box-shadow: inset 3px 0 var(--route); }
.ent-ligne:hover { background: var(--route-pale); }
.ent-ligne b { display: block; font-weight: 600; }
.ent-ligne small, .ent-meta, .ent-aide { font-size: var(--t-meta); line-height: 18px; color: var(--encre-2); }
.ent-ligne small:not(:empty) { display: block; }
.ent-ligne small .i { color: var(--encre); margin-right: 4px; }
.ent-icone {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: var(--r);
  background: var(--gris-pale);
  color: var(--gris);
}
.ent-chevron { color: var(--trait-fort); }
.ent-ligne[aria-current] :is(.ent-icone,.ent-chevron) { color: var(--route); }
.ent-ligne[aria-current] .ent-icone { background: var(--carte); }
.ent-ligne.ent-fleet-urgent .ent-icone { background: var(--rouge-pale); color: var(--rouge); }
.ent-urgent { color: var(--rouge); }
.ent-attention { color: var(--orange); }
.ent-autres { margin-top: 8px; border-top: 1px solid var(--trait); }
.mx .ent-autres p { padding: 14px 16px 4px; color: var(--encre-2); font-size: var(--t-meta); font-weight: 600; }
.ent-autres .ent-ligne:first-child { border-top: 1px solid var(--trait); }

.ent-alerte {
  display: flex;
  gap: 10px;
  align-items: center;
  height: 44px;
  padding: 0 14px;
  border: 1px solid var(--trait);
  border-radius: var(--r);
  background: var(--carte);
  box-shadow: var(--ombre);
  box-sizing: border-box;
  color: var(--encre);
  text-decoration: none;
  white-space: nowrap;
}
.ent-alerte :is(b,.ent-alerte-voir) { font-weight: 600; }
#fleet-alert-detail { min-width: 0; color: var(--encre-2); overflow: hidden; text-overflow: ellipsis; }
.ent-alerte-voir { display: flex; align-items: center; gap: 4px; margin-left: auto; }

.ent-editeur { min-width: 0; display: grid; gap: 16px; }
.mx :is(.ent-rubrique,.ent-apercu) { padding: 20px 24px; overflow-wrap: anywhere; }
.ent-editeur .carte-tete { margin-bottom: 16px; }
.ent-editeur .carte-tete p { color: var(--encre-2); }
.ent-rubrique > p { color: var(--encre-2); }
.ent-rubrique > .btn { margin-top: 12px; }
.ent-feuille {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 256px);
  gap: 20px;
  padding: 16px 24px;
  border: 1px solid var(--trait-fort);
  border-radius: var(--r);
  box-shadow: var(--ombre);
}
.ent-destinataire { padding-left: 20px; border-left: 1px solid var(--trait); }
.mx .ent-destinataire h3 { margin-bottom: 6px; font-family: var(--texte); }
.ent-apercu .carte-tete { margin-bottom: 12px; }

.ent-editeur .fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 16px;
}
.ent-editeur .wide { grid-column: 1 / -1; }
.ent-editeur :is(.fields,.res-row) label { display: grid; gap: 4px; align-content: end; min-width: 0; }
.ent-editeur label { font-weight: 600; }
.ent-editeur .btn { max-width: 100%; white-space: normal; }
.ent-editeur input:not([type=checkbox]), .ent-editeur select, .ent-editeur textarea {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  min-height: var(--controle);
  box-sizing: border-box;
  border: 1px solid var(--trait-fort);
  border-radius: var(--r);
  padding: 8px 12px;
  background: var(--carte);
  color: var(--encre);
  font: 400 var(--t-corps)/1.45 var(--texte);
}
.ent-editeur :is(input[type=date],select) { appearance: none; }
.ent-editeur select {
  padding-right: 30px;
  background:
    linear-gradient(45deg, transparent 50%, var(--encre-2) 50%) right 15px center / 5px 5px no-repeat,
    linear-gradient(135deg, var(--encre-2) 50%, transparent 50%) right 10px center / 5px 5px no-repeat,
    var(--carte);
}
.ent-editeur input[type=checkbox] { min-width: 0; max-width: 100%; box-sizing: border-box; accent-color: var(--route); }
.ent-editeur textarea { resize: vertical; }
.ent-editeur textarea.court { field-sizing: content; }
@supports (field-sizing: content) {
  .ent-editeur textarea:is([name="insurer"], [name="mediator"]) { resize: none; }
}
.ent-editeur :is(input,select,textarea):focus { border-color: var(--route); }
.mx .ent-editeur :is(input,select,textarea):focus-visible { outline: 2px solid var(--route-pale); outline-offset: 1px; }
.ent-modifie { display: inline-flex; gap: 6px; align-items: center; margin-left: 8px; color: var(--orange); font-size: var(--t-meta); }
.ent-modifie::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--orange); }

.mx #mentions-state { margin: 12px 0 16px; color: var(--encre-2); }
.mx #mentions-missing { margin-top: 4px; padding-left: 1em; list-style: disc; }
#mentions-missing a { color: var(--route); }
#factures-title { margin-top: 8px; }
#cgv-editor { box-sizing: border-box; border: 0; color: var(--encre); }
#cgv-editor h3 { margin-bottom: 8px; }
#cgv-editor textarea { field-sizing: content; min-height: 12em; }
.mx #cgv-aide { margin-top: 4px; }

.ent-ressources { margin-top: 12px; }
.res-row {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) auto;
  gap: 8px 12px;
  align-items: end;
  padding: 12px 0;
}
.res-row + .res-row { border-top: 1px solid var(--trait); }
.res-row.is-team { grid-template-columns: minmax(0, 1fr) auto; }
.res-row.is-person { grid-template-columns: minmax(0, 2fr) minmax(0, 1.4fr) minmax(0, 1.4fr) auto; }
.res-equipe { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 16px; }
.res-row.retired > :is(label,p,div) { color: var(--encre-2); }
.ent-editeur .retirer { color: var(--encre-2); text-decoration: none; }
.ent-editeur .retirer:hover { color: var(--route); }
.ent-editeur :is(.res-indispo,.ent-echeances) { grid-column: 1 / -1; min-width: 0; }
.ent-editeur .res-indispo li { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; justify-content: space-between; }
.res-indispo summary { padding-block: 10px; cursor: pointer; color: var(--route); font-weight: 600; list-style: none; }
.res-indispo summary::-webkit-details-marker { display: none; }
.res-indispo summary::before { content: "+ "; }
.res-indispo details[open] summary::before { content: "− "; }
.res-indispo button { margin-top: 8px; }
.res-indispo .alert { color: var(--rouge); }
.ent-echeances { margin: 8px 0 0; padding: 12px; border: 1px solid var(--trait); border-radius: var(--r); }
.ent-echeances legend { font-weight: 600; padding-inline: 4px; }
.ent-echeances .fields { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.mx #inventaire-boxes { margin-top: 12px; }

.mx .ent-barre {
  background: var(--carte);
  display: flex;
  gap: 12px;
  justify-content: space-between;
  align-items: center;
  padding: 10px;
  box-shadow: var(--ombre-dialogue);
}
.ent-barre > div:first-child { min-width: 0; padding-inline: 8px; overflow-wrap: anywhere; }
.ent-boutons { display: flex; flex: none; gap: 10px; }
#ent-etat { font-weight: 600; }
#ent-etat[data-etat=modifie]::before { content: ''; display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 8px; background: var(--orange); }
#ent-etat[data-etat=refus] { color: var(--rouge); }
.mx .ent-page #status:not(:empty) { color: var(--encre-2); font-size: var(--t-meta); }
.mx .ent-page #status:empty { display: none; }

@media screen and (min-width: 1024px) {
  .mx .ent-enregistrement { position: sticky; bottom: 72px; z-index: 5; }
  .mx #cgv-editor { position: static; margin: 16px 0 0; padding: 0; width: auto; max-width: none; }
}
@media screen and (max-width: 1150px) {
  .ent-colonnes { grid-template-columns: 260px minmax(0, 1fr); }
  .res-row.is-person { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ent-feuille { grid-template-columns: minmax(0, 1fr) minmax(0, 190px); gap: 12px; }
}
@media screen and (max-width: 1023px) {
  .mx .ent-page-contenu { padding: 18px 16px 24px; gap: 16px; }
  .ent-colonnes { grid-template-columns: minmax(0, 1fr); }
  .ent-menu { display: grid; gap: 12px; }
  .mx .ent-identite-mobile {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 20px;
    gap: 12px;
    padding: 16px;
    text-decoration: none;
    color: var(--encre);
    overflow-wrap: anywhere;
  }
  .ent-identite-mobile :is(strong,.ent-meta) { display: block; }
  .ent-identite-mobile strong { font: 700 var(--t-carte)/24px var(--texte); }
  .ent-identite-mobile .ent-chevron { align-self: center; }
  .ent-identite-mobile .pastille { margin-top: 8px; }
  .ent-identite-ligne { display: none; }
  .mx .ent-sommaire { padding: 0; border: 0; border-radius: 0; background: transparent; box-shadow: none; }
  .ent-sommaire nav { padding: 8px 0; border: 1px solid var(--trait); border-radius: var(--r-l); background: var(--carte); box-shadow: var(--ombre); }
  .ent-autres { margin-top: 12px; border-top: 0; }
  .mx .ent-autres p { padding: 0 0 8px; }
  .ent-sommaire > nav .ent-ligne:nth-child(2), .ent-autres .ent-ligne:first-child { border-top: 0; }
  .ent-ligne { min-height: 72px; }
  .ent-alerte :is(#fleet-alert-detail,.ent-alerte-voir > span:first-child) { display: none; }
  .ent-alerte b { min-width: 0; white-space: normal; line-height: 18px; }
  .mx .ent-page[data-ent-rubrique] :is(.mx-nav-bas,.ent-menu) { display: none; }
  .mx:has(.ent-page[data-ent-rubrique]) { scroll-padding-bottom: 148px; }
  .mx .ent-page[data-ent-rubrique] { padding-bottom: calc(148px + env(safe-area-inset-bottom)); }
  .ent-retour { display: inline-flex; gap: 8px; align-items: center; min-height: var(--controle); justify-self: start; }
  .mx :is(.ent-rubrique,.ent-apercu) { padding: 16px; }
  .mx .ent-barre {
    position: fixed;
    inset: auto 0 0;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    padding: 8px 16px calc(8px + env(safe-area-inset-bottom));
    border-radius: 0;
    border-width: 1px 0 0;
    z-index: 40;
  }
  .ent-barre > div:first-child { padding-inline: 0; }
  .ent-barre > div:first-child:has(#ent-etat:empty) { display: none; }
  .ent-boutons > * { flex: 1; }
  #cgv-editor {
    position: fixed;
    inset: 0;
    width: 100%;
    max-width: none;
    height: 100%;
    max-height: none;
    margin: 0;
    padding: 16px;
    background: var(--carte);
  }
  #cgv-editor[open] { display: flex; flex-direction: column; gap: 8px; }
  #cgv-editor label { flex: 1; min-height: 0; }
  #cgv-editor textarea { height: 100%; min-height: 0; resize: none; }
}
@media screen and (max-width: 700px) {
  .ent-editeur .fields, .ent-editeur .res-row, .ent-editeur .res-row.is-team,
  .ent-editeur .res-row.is-person, .ent-editeur .res-equipe, .ent-feuille { grid-template-columns: minmax(0, 1fr); }
  .ent-editeur .btn { width: 100%; min-width: 0; }
  .ent-destinataire { padding: 12px 0 0; border-left: 0; border-top: 1px solid var(--trait); }
}

.ent-identite-champs { display: grid; grid-template-columns: 108px minmax(0, 1fr); column-gap: 16px; row-gap: 12px; }
.ent-logo { display: grid; align-content: start; justify-items: start; gap: 4px; font-size: var(--t-meta); }
.ent-logo > b { font-size: var(--t-corps); }
.ent-logo-cadre {
  display: grid;
  place-items: center;
  width: 96px;
  height: 96px;
  box-sizing: border-box;
  overflow: hidden;
  border: 1.5px dashed var(--trait-fort);
  border-radius: var(--r-l);
  background: var(--fond);
  color: var(--encre-2);
}
.ent-logo-cadre:has(img) { border-style: solid; background: var(--carte); }
#logo-vide:not([hidden]) { display: grid; justify-items: center; gap: 4px; }
.ent-logo-cadre svg { width: 24px; height: 24px; }
.ent-logo-cadre img { width: 100%; height: 100%; min-height: 0; object-fit: contain; }
.ent-logo-mobile { width: 48px; height: 48px; border-radius: var(--r); }
.mx .ent-logo-action {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 44px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--route);
  font: inherit;
  font-size: var(--t-corps);
  font-weight: 600;
}
.ent-logo-action svg { width: 16px; height: 16px; }
#logo-message:empty { display: none; }
#preview-logo img { display: block; max-width: 100%; width: auto; max-height: 56px; margin-bottom: 6px; }
.mx .ent-ligne .ent-attention { color: var(--orange); font-weight: 600; }
@media screen and (max-width: 1023px) {
  .mx .ent-identite-mobile { grid-template-columns: 48px minmax(0, 1fr) 20px; }
  .mx .ent-logo-action { min-height: 48px; }
}
@media screen and (max-width: 600px) {
  .ent-identite-champs { grid-template-columns: minmax(0, 1fr); }
}
