/* Formulaire marin : même mise en page que le formulaire DocuWare, finitions modernisées */
:root {
  --navy: #242f6b;
  --navy-2: #3b4a9a;
  --navy-bg: #eef0fa;
  --texte: #1f2330;
  --texte-2: #5b6170;
  --gris: #8b91a0;
  --bord: #d5d9e0;
  --bord-doux: #e6e8ec;
  --fond: #eef1f5;
  --rouge: #d42a14;
  --orange: #f2b33d;
  --orange-h: #e9a520;
  --vert: #1a7f4b;
  --vert-bg: #e8f5ee;
  --rouge-bg: #fdeeeb;
  --ambre: #9a5800;
  --ambre-bg: #fff4e0;
  --rayon: 6px;
  --anneau: 0 0 0 3px rgba(59, 74, 154, .16);
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--fond);
  color: var(--texte);
  font: 13.5px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

.page {
  max-width: 760px;
  margin: 32px auto;
  background: #fff;
  border: 1px solid var(--bord-doux);
  border-radius: 10px;
  box-shadow: 0 1px 2px rgba(20, 23, 31, .04), 0 8px 24px -12px rgba(20, 23, 31, .12);
  padding: 32px 40px 36px;
}

/* --- En-tête */
.entete { display: grid; grid-template-columns: 170px 1fr; gap: 12px 24px; align-items: start; }
.logo { display: block; width: 150px; height: auto; }
.entete h1 { margin: 6px 0 10px; font-size: 19px; font-weight: 700; letter-spacing: -0.01em; color: var(--texte); }
.avertissement {
  color: var(--rouge); font-size: 12px; margin: 0; max-width: 380px; justify-self: end;
  padding-left: 10px; border-left: 2px solid currentColor;
}

/* --- Champs */
label.champ { display: block; font-weight: 650; font-size: 12.5px; margin-bottom: 6px; color: var(--texte); }
input[type=text], input[type=date], input[type=number], input[type=search], select, textarea {
  font: inherit;
  color: var(--texte);
  border: 1px solid var(--bord);
  background: #fff;
  border-radius: var(--rayon);
  padding: 7px 11px;
  height: 38px;
  width: 100%;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}
input::placeholder, textarea::placeholder { color: var(--gris); }
select {
  appearance: none; padding-right: 32px; cursor: pointer;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='m4.5 6.5 3.5 3.5 3.5-3.5' fill='none' stroke='%235b6170' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") right 10px center/14px no-repeat;
}
textarea { height: 80px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--navy-2); box-shadow: var(--anneau); }
input[readonly] { background: #f6f7f9; color: var(--texte-2); }
@media (hover: hover) and (pointer: fine) {
  input:not([readonly]):not(:focus):hover, select:not(:focus):hover, textarea:not(:focus):hover { border-color: #b9bfca; }
}

.ligne-date { margin-top: 18px; width: 160px; }
.identite { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 16px; margin-top: 24px; }

.aide { margin: 6px 0 0; font-size: 12px; color: var(--ambre); }

/* --- Recherche du marin */
.combo { position: relative; }
.combo input { padding-left: 34px; }
.combo-icone { position: absolute; left: 11px; top: 11px; width: 16px; height: 16px; fill: none; stroke: var(--gris); stroke-width: 1.6; stroke-linecap: round; pointer-events: none; }
.combo-liste {
  position: absolute; z-index: 20; top: calc(100% + 6px); left: 0; right: 0;
  margin: 0; padding: 4px; list-style: none; max-height: 300px; overflow: auto; overscroll-behavior: contain;
  background: #fff; border: 1px solid var(--bord-doux); border-radius: 8px;
  box-shadow: 0 12px 32px -8px rgba(20, 23, 31, .22), 0 2px 6px rgba(20, 23, 31, .06);
  transform-origin: top center;
  transition: opacity 140ms var(--ease-out), transform 140ms var(--ease-out);
  @starting-style { opacity: 0; transform: scale(0.98) translateY(-2px); }
}
.combo-liste [role=option] {
  display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
  padding: 8px 10px; border-radius: 5px; cursor: pointer;
}
.combo-liste [role=option][aria-selected=true] { background: var(--navy-bg); }
@media (hover: hover) and (pointer: fine) {
  .combo-liste [role=option]:hover { background: #f3f4f7; }
  .combo-liste [role=option][aria-selected=true]:hover { background: var(--navy-bg); }
}
.opt-nom { font-weight: 500; }
.opt-nom mark { background: none; color: var(--navy-2); font-weight: 700; }
.opt-meta { font-size: 12px; color: var(--gris); white-space: nowrap; }
.opt-nouveau { justify-content: flex-start !important; color: var(--navy); border-top: 1px solid var(--bord-doux); margin-top: 2px; }
.opt-plus { width: 20px; height: 20px; border-radius: 50%; background: var(--navy-bg); display: inline-grid; place-items: center; font-weight: 700; flex: none; }
.opt-vide { padding: 10px; color: var(--gris); font-size: 12.5px; }

/* --- Sections */
hr.sep { border: 0; border-top: 1px solid var(--bord); margin: 28px 0 18px; }
h2.section { font-size: 12px; font-weight: 700; margin: 0 0 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--texte-2); }

.vide { color: var(--gris); padding: 16px; text-align: center; background: #f8f9fb; border: 1px dashed var(--bord); border-radius: 8px; }

/* --- Articles */
.grille { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 8px; }

.article {
  padding: 10px 12px 11px; border: 1px solid var(--bord-doux); border-radius: 8px; background: #fff;
  transition: border-color 150ms ease, background-color 150ms ease, box-shadow 150ms ease;
}
.article.coche { border-color: var(--navy-2); background: #f7f8fd; box-shadow: inset 0 0 0 1px var(--navy-2); }
.article.bloque { background: #fafafb; }
@media (hover: hover) and (pointer: fine) {
  .article:not(.bloque):not(.coche):hover { border-color: var(--bord); }
}
.article .tete { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; font-size: 13px; font-weight: 550; }
.article input[type=checkbox], .article input[type=radio] {
  appearance: none; flex: none; margin: 1px 0 0;
  width: 16px; height: 16px; border: 1.5px solid #b3b9c4; background: #fff; cursor: pointer; border-radius: 4px;
  transition: background-color 120ms ease, border-color 120ms ease, transform 120ms var(--ease-out);
}
.article input:active { transform: scale(0.9); }
.article input[type=radio] { border-radius: 50%; }
.article input[type=checkbox]:checked { background: var(--navy) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3.5 8.5l3 3 6-7' fill='none' stroke='white' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/12px no-repeat; border-color: var(--navy); }
.article input[type=radio]:checked { box-shadow: inset 0 0 0 3.5px #fff; background: var(--navy); border-color: var(--navy); }
.article input:focus-visible { outline: none; box-shadow: var(--anneau); }
.article input:disabled { background: #eef0f3; border-color: #d5d9e0; cursor: not-allowed; }

.article .infos { margin: 4px 0 0 26px; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-size: 11.5px; color: var(--gris); }
.article.bloque .tete { color: #a3a8b3; cursor: not-allowed; }
.article .bloque-msg { color: var(--ambre); }

.badge { display: inline-flex; align-items: center; font-size: 11px; font-weight: 600; padding: 0 7px; border-radius: 10px; line-height: 18px; white-space: nowrap; }
.badge.ok { color: var(--vert); background: var(--vert-bg); }
.badge.ko { color: var(--rouge); background: var(--rouge-bg); }
.badge.partiel { color: var(--ambre); background: var(--ambre-bg); }
.badge.neutre { color: var(--texte-2); background: #f0f1f4; }

.article .details { margin: 10px 0 0 26px; display: grid; gap: 8px; }
.article .details[hidden] { display: none; }
.article .options { display: grid; gap: 2px; }
.article .options label { display: flex; gap: 8px; align-items: center; font-size: 12.5px; cursor: pointer; padding: 3px 0; }
.article .details select, .article .details input[type=number] { height: 32px; padding: 4px 30px 4px 9px; max-width: 170px; font-size: 12.5px; background-position: right 8px center; }
.article .details input[type=number] { padding-right: 9px; width: 80px; margin-left: 6px; }
.article .details > label { font-size: 12.5px; color: var(--texte-2); }
.taille-piece { display: grid; grid-template-columns: 88px minmax(0, 170px); align-items: center; gap: 8px; }
.taille-piece[hidden] { display: none; }

/* --- Pied */
.commentaire { margin-top: 28px; }
.actions { display: flex; justify-content: flex-end; align-items: center; gap: 16px; margin-top: 18px; }
.erreur { color: var(--rouge); font-size: 12.5px; }

button, .bouton {
  font: inherit; font-weight: 650; border: 0; cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--orange); color: #3a2a00; padding: 0 32px; height: 42px; border-radius: var(--rayon);
  box-shadow: 0 1px 2px rgba(140, 90, 0, .25), inset 0 1px 0 rgba(255, 255, 255, .35);
  transition: background-color 150ms ease, transform 160ms var(--ease-out);
}
@media (hover: hover) and (pointer: fine) { button:hover, .bouton:hover { background: var(--orange-h); } }
button:active, .bouton:active { transform: scale(0.97); }
button:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(242, 179, 61, .45); }
button:disabled { opacity: .6; cursor: progress; }

.merci { text-align: center; padding: 48px 0 24px; }
.merci-icone {
  width: 56px; height: 56px; border-radius: 50%; margin: 0 auto 16px; display: grid; place-items: center;
  background: var(--vert-bg); color: var(--vert);
  transition: transform 300ms var(--ease-out), opacity 300ms var(--ease-out);
  @starting-style { transform: scale(0.8); opacity: 0; }
}
.merci-icone svg { width: 28px; height: 28px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.merci h2 { color: var(--texte); font-size: 20px; margin: 0 0 6px; }
.merci p { color: var(--texte-2); margin: 0 0 24px; }

/* --- Mobile */
@media (max-width: 640px) {
  .page { margin: 0; border: 0; border-radius: 0; box-shadow: none; padding: 20px 16px 28px; }
  .entete { grid-template-columns: 1fr; }
  .logo { width: 120px; }
  .avertissement { justify-self: start; }
  .identite { grid-template-columns: 1fr 1fr; }
  .identite > :first-child { grid-column: 1 / -1; }
  .grille { grid-template-columns: 1fr; }
  input[type=text], input[type=date], input[type=number], select, textarea { font-size: 16px; } /* évite le zoom iOS */
  .actions { flex-direction: column-reverse; align-items: stretch; }
  .combo-liste { max-height: 50vh; }
}

@media (prefers-reduced-motion: reduce) {
  .combo-liste, .merci-icone { transition: opacity 120ms ease; @starting-style { opacity: 0; } }
  .article input:active, button:active { transform: none; }
}
