:root {
  color-scheme: light;
  --bg: #f4f6fb;
  --content: 820px;
  --gutter: 24px;
  --card: #ffffff;
  --ink: #172033;
  --muted: #6b7488;
  --line: #dfe3ec;
  --brand: #4f46e5;
  --brand-hover: #4338ca;
  --danger: #b42318;
  --success: #067647;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.5;
  color: var(--ink);
  background: radial-gradient(1000px 600px at 15% -10%, #dfe4ff 0%, transparent 60%), var(--bg);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  width: 100%;
  background: #fff;
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  position: relative;
  width: 100%;
  margin: 0;
  padding: 16px var(--gutter);
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
}
.logo-desktop.logo-charge,
.logo-mobile.logo-charge {
  background: transparent;
  border-color: transparent;
}
.logo-desktop,
.logo-mobile {
  object-fit: contain;
  background: #eef4ff;
  border: 1px dashed #cfe0ff;
  border-radius: 8px;
  color: transparent;
  font-size: 0;
}
.logo-desktop {
  display: block;
  width: 150px;
  height: 46px;
}
.logo-mobile {
  display: none;
  width: 38px;
  height: 38px;
}
.menu-toggle {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: auto;
  min-height: 0;
  padding: 6px 12px;
  color: #000;
  background: transparent;
  border: 0;
  border-radius: 0;
  font-size: 14px;
  font-weight: 700;
}
.topbar .menu-toggle:hover { background: transparent; }
.search-btn {
  margin-left: auto;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  min-height: 0;
  padding: 0;
  color: #000;
  background: transparent;
  border: 0;
  border-radius: 8px;
}
.topbar .search-btn:hover { background: #f4f6fb; }
.lignes {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.lignes span {
  display: block;
  width: 22px;
  height: 2px;
  background: #000;
  border-radius: 2px;
}
.menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 18px;
  flex-direction: column;
  gap: 0;
  min-width: 190px;
  padding: 8px;
  background-color: #fff;
  background-image: repeating-linear-gradient(135deg, rgba(22, 65, 148, .07) 0 2px, transparent 2px 10px);
  border: 1px solid #cfe0ff;
  border-radius: 10px;
  box-shadow: 0 12px 30px rgba(23, 32, 51, .12);
}
.menu.ouvert { display: flex; }
.menu a {
  position: relative;
  color: #000;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  padding: 9px 10px 9px 26px;
  border-radius: 6px;
  background: rgba(255, 255, 255, .8);
}
.menu a::before {
  content: "";
  position: absolute;
  left: 11px;
  top: 50%;
  width: 6px;
  height: 6px;
  margin-top: -3px;
  transform: rotate(45deg);
  background: #164194;
  border-radius: 1px;
}
.menu a:hover { background: #eef4ff; text-decoration: none; }

.shell {
  width: min(var(--content), 100%);
  margin: 0 auto;
  padding: 28px var(--gutter) 56px;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 42px 46px;
  box-shadow: 0 24px 60px rgba(22, 65, 148, .10);
}

.page-title {
  text-align: center;
  padding: 30px 18px 0;
  font-size: 34px;
  font-weight: 700;
  letter-spacing: -.02em;
  color: #164194;
}
h1 {
  font-size: 22px;
  margin: 0 0 14px;
  letter-spacing: -.02em;
  text-align: center;
  color: #164194;
}
.field { margin-bottom: 20px; position: relative; }
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 7px; }
.required { color: var(--danger); font-weight: 700; }

.field-label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 7px;
}
.motif-field { position: relative; }
.motif-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 48px;
  padding: 12px 15px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 11px;
  font-size: 15px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}
.motif-toggle:hover { border-color: #164194; }
.motif-toggle:focus-visible { outline: 3px solid rgba(22, 65, 148, .2); outline-offset: 1px; }
.chevron {
  width: 8px;
  height: 8px;
  border-right: 2px solid #164194;
  border-bottom: 2px solid #164194;
  transform: rotate(45deg);
  margin: -4px 4px 0 0;
}
.motif-toggle[aria-expanded="true"] .chevron { transform: rotate(225deg); margin: 4px 4px 0 0; }
.motif-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 5;
  margin-top: 6px;
  padding: 6px;
  background: #fff;
  border: 1px solid #cfe0ff;
  border-radius: 10px;
  box-shadow: 0 14px 30px rgba(23, 32, 51, .14);
}
.motif-menu.ouvert { display: flex; flex-direction: column; }
.motif-menu button {
  width: 100%;
  min-height: 0;
  padding: 10px 12px;
  color: #000;
  background: transparent;
  border: 0;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}
.motif-menu button:hover, .motif-menu button[aria-selected="true"] {
  background: #eef4ff;
  color: #164194;
}

input, textarea {
  width: 100%;
  font: inherit;
  font-size: 16px; /* évite le zoom automatique sur iOS */
  color: var(--ink);
  background: #fbfcfe;
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 13px 15px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}

textarea { resize: vertical; min-height: 140px; line-height: 1.6; }

input:focus, textarea:focus {
  border-color: #164194;
  box-shadow: 0 0 0 3px rgba(22, 65, 148, .15);
}

input:invalid:not(:placeholder-shown), textarea:invalid:not(:placeholder-shown) {
  border-color: #f04438;
}

.counter {
  position: absolute;
  right: 4px;
  bottom: -17px;
  font-size: 12px;
  color: var(--muted);
}

.honeypot {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.status { min-height: 22px; margin: 4px 0 12px; font-size: 14px; }
.status.ok { color: var(--success); }
.status.error { color: var(--danger); }

button {
  width: 100%;
  min-height: 50px;
  font: inherit;
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  background: #164194;
  border: 0;
  border-radius: 999px;
  padding: 14px 18px;
  cursor: pointer;
  transition: background .15s, transform .15s;
}
button:hover:not(:disabled) { background: #0f306b; }
button:active:not(:disabled) { transform: translateY(1px); }
button:disabled { opacity: .6; cursor: not-allowed; }

/* Bouton principal d'action : plus compact que les autres boutons */
#submit {
  display: block;
  width: auto;
  min-width: 190px;
  min-height: 42px;
  margin: 4px auto 0;
  padding: 9px 22px;
  font-size: 15px;
}
.actions #submit { flex: 0 0 auto; margin: 0; }

.actions { position: relative; display: flex; align-items: center; justify-content: center; gap: 12px; }
.actions button { flex: 1; }
.back {
  position: absolute;
  left: 0;
  color: #164194;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  padding: 0 6px;
  white-space: nowrap;
}
.back:hover { text-decoration: underline; }

.privacy {
  margin: 24px 0 0;
  padding: 16px 18px;
  background: #eef4ff;
  border: 1px solid #cfe0ff;
  border-left: 4px solid #164194;
  border-radius: 8px;
  color: #164194;
  font-size: 13px;
  line-height: 1.6;
}
.privacy::before { content: "ℹ️ "; }

/* Page de confirmation */
.confirmation { text-align: center; }
.confirmation-check {
  width: 72px;
  height: 72px;
  margin: 4px auto 20px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #e8f7ef;
  border: 2px solid #067647;
  color: #067647;
  font-size: 36px;
  font-weight: 700;
  line-height: 1;
}
.confirmation h1 { font-size: 26px; margin-bottom: 10px; }
.confirmation-texte { margin: 0 0 6px; font-size: 16px; font-weight: 600; }
.confirmation-suite { margin: 0 0 26px; font-size: 14px; color: var(--muted); }
.confirmation-btn {
  display: inline-block;
  min-height: 42px;
  padding: 10px 24px;
  color: #fff;
  background: #164194;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 700;
  text-decoration: none;
}
.confirmation-btn:hover { background: #0f306b; }

/* Page de chargement entre les étapes */
.page-chargement { display: grid; place-items: center; padding: 24px; }
.chargement { text-align: center; }
.chargeur {
  position: relative;
  width: 180px;
  height: 180px;
  margin: 0 auto;
  display: grid;
  place-items: center;
}
.chargeur-piste {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 8px solid #e3ebff;
}
.chargeur-bande {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: conic-gradient(from 0deg, #164194 0 18%, transparent 18% 100%);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 8px), #000 calc(100% - 8px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 8px), #000 calc(100% - 8px));
  animation: rotation-chargement 1s linear infinite;
}
@keyframes rotation-chargement { to { transform: rotate(360deg); } }
.chargeur-logo {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}
.chargeur-logo .logo-desktop { width: 120px; height: 38px; }
.chargeur-logo .logo-mobile { width: 44px; height: 44px; }
.chargement-texte {
  margin: 26px 0 0;
  color: #164194;
  font-size: 14px;
  font-weight: 600;
}

@media (max-width: 540px) {
  :root { --gutter: 14px; }
  .shell { padding: 18px var(--gutter) 30px; }
  .card { padding: 24px 18px; border-radius: 16px; }
  .page-title { font-size: 26px; padding-top: 16px; }
  h1 { font-size: 20px; margin-bottom: 12px; }
  .topbar-inner { padding: 10px var(--gutter); gap: 8px; }
  .logo-desktop { display: none; }
  .logo-mobile { display: block; }
  .menu { gap: 12px; left: var(--gutter); }
  .menu a { font-size: 13px; }
  .menu-toggle { padding: 6px 8px; }
  .search-btn { width: 40px; height: 40px; }
  .field { margin-bottom: 16px; }
  .form-row { grid-template-columns: 1fr; gap: 0; }
  .actions { flex-direction: column-reverse; align-items: stretch; gap: 14px; }
  .actions button { width: 100%; }
  #submit { width: 100%; min-width: 0; }
  .back { position: static; text-align: center; padding: 8px; }
  .privacy { font-size: 12.5px; padding: 14px; }
}

@media (min-width: 541px) and (max-width: 900px) {
  :root { --gutter: 18px; }
  .shell { padding: 24px var(--gutter) 48px; }
  .topbar-inner { padding: 14px var(--gutter); }
  .card { padding: 32px 30px; }
}
