/* Retracto · toutes les couleurs, tailles et arrondis viennent des variables --rt-*,
   posées sur .rt à partir des réglages de l'app. Valeurs de repli pour le premier rendu. */
.rt {
  --rt-font: inherit;
  --rt-heading-font: inherit;
  --rt-size: 15px;
  --rt-heading-size: 24px;
  --rt-bg: #ffffff;
  --rt-text: #1a1a1a;
  --rt-muted: #6b6b6b;
  --rt-primary: #111111;
  --rt-primary-text: #ffffff;
  --rt-border: #dcdcdc;
  --rt-accent: #1f5eff;
  --rt-radius: 12px;
  --rt-button-radius: 999px;
  --rt-max-width: 640px;
  --rt-error: #b42318;
  box-sizing: border-box;
  width: 100%;
  max-width: var(--rt-max-width);
  margin: 0 auto;
  padding: clamp(20px, 4vw, 32px);
  font-family: var(--rt-font);
  font-size: var(--rt-size);
  line-height: 1.5;
  color: var(--rt-text);
  background: var(--rt-bg);
  border: 1px solid var(--rt-border);
  border-radius: var(--rt-radius);
}
.rt *, .rt *::before, .rt *::after { box-sizing: border-box; }
.rt-wrap { padding-block: var(--rt-pad-top, 36px) var(--rt-pad-bottom, 36px); padding-inline: 16px; }
.rt-wrap--page { padding-block: clamp(32px, 6vw, 72px); }
.rt__title { margin: 0 0 6px; font-family: var(--rt-heading-font); font-size: var(--rt-heading-size); line-height: 1.15; font-weight: 700; letter-spacing: -0.01em; color: var(--rt-text); }
/* Page dédiée servie par l'App Proxy : titre un peu plus grand, comme un titre de page. */
.rt-wrap--page .rt__title { font-size: calc(var(--rt-heading-size) * 1.2); }
.rt__intro { margin: 0 0 22px; color: var(--rt-muted); }
.rt__subtitle { margin: 0; font-family: var(--rt-heading-font); font-size: calc(var(--rt-size) * 1.3); line-height: 1.25; font-weight: 650; letter-spacing: -0.005em; outline: none; }
.rt__muted { color: var(--rt-muted); font-size: 0.93em; }
.rt__sr, .rt__visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; margin: -1px; padding: 0; border: 0; }

/* Progression : compteur, mention du délai et trois segments. */
.rt__progress { display: grid; gap: 10px; margin: 0 0 22px; }
.rt__progress-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.rt__progress-count { font-size: 0.8em; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--rt-muted); }
.rt__badge { display: inline-flex; align-items: center; gap: 6px; font-size: 0.8em; font-weight: 500; color: var(--rt-text); padding: 4px 10px; border-radius: 999px; background: color-mix(in srgb, var(--rt-accent) 9%, var(--rt-bg)); }
.rt__badge svg { color: var(--rt-accent); }
.rt__bars { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; list-style: none; margin: 0; padding: 0; }
.rt__bar { position: relative; height: 4px; border-radius: 4px; background: color-mix(in srgb, var(--rt-border) 70%, var(--rt-bg)); overflow: hidden; }
.rt__bar::after { content: ""; position: absolute; inset: 0; background: var(--rt-primary); transform: scaleX(0); transform-origin: left; transition: transform .45s cubic-bezier(.2, .8, .2, 1); }
.rt__bar.is-done::after, .rt__bar.is-current::after { transform: scaleX(1); }
.rt__bar.is-current::after { opacity: .55; }

.rt__form { display: grid; gap: 16px; animation: rt-in .35s ease both; }
@keyframes rt-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.rt__grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.rt__field { display: grid; gap: 6px; min-width: 0; }
.rt__optional { font-weight: 400; color: var(--rt-muted); }
.rt__hint { margin: 0 2px; font-size: 0.82em; color: var(--rt-muted); }
.rt__error { margin: 0 2px; font-size: 0.82em; font-weight: 500; color: var(--rt-error); }
.rt__hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* Champs à libellé flottant. */
.rt__float { position: relative; }
.rt__input {
  display: block; width: 100%; min-height: 56px; padding: 24px 14px 8px; margin: 0; font: inherit; line-height: 1.3; color: var(--rt-text);
  background: var(--rt-bg); border: 1px solid var(--rt-border); border-radius: calc(var(--rt-radius) * 0.75);
  transition: border-color .15s ease, box-shadow .15s ease; appearance: none; -webkit-appearance: none;
}
select.rt__input {
  padding-right: 40px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='m6 8 4 4 4-4' fill='none' stroke='%23888' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; background-size: 18px;
}
.rt__textarea { min-height: 104px; padding-top: 28px; resize: vertical; }
.rt__label {
  position: absolute; left: 15px; top: 18px; max-width: calc(100% - 30px); pointer-events: none;
  font-size: 1em; color: var(--rt-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transform-origin: left top; transition: transform .15s ease, color .15s ease;
}
.rt__input:focus + .rt__label, .rt__input:not(:placeholder-shown) + .rt__label, .rt__float--static .rt__label { transform: translateY(-10px) scale(.78); }
.rt__input:hover { border-color: color-mix(in srgb, var(--rt-text) 35%, var(--rt-border)); }
.rt__input:focus { outline: none; border-color: var(--rt-accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--rt-accent) 18%, transparent); }
.rt__input:focus + .rt__label { color: var(--rt-accent); }
.rt__input[aria-invalid="true"] { border-color: var(--rt-error); box-shadow: 0 0 0 3px color-mix(in srgb, var(--rt-error) 12%, transparent); }
.rt__input::placeholder { color: transparent; }

.rt__alert { margin: 0; padding: 12px 14px; border-radius: calc(var(--rt-radius) * 0.75); font-size: 0.93em; }
.rt__alert--error { color: var(--rt-error); background: color-mix(in srgb, var(--rt-error) 7%, var(--rt-bg)); }
.rt__alert--info { background: color-mix(in srgb, var(--rt-accent) 7%, var(--rt-bg)); }
[data-rt-message] { outline: none; }
[data-rt-message]:empty { display: none; }

/* Coche ronde des tuiles et articles. */
.rt__tick {
  display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; flex: 0 0 auto; border-radius: 50%;
  border: 1.5px solid var(--rt-border); color: transparent; background: var(--rt-bg); transition: background .15s ease, border-color .15s ease, color .15s ease;
}

/* Commandes du client connecté, en tuiles. */
.rt__orders { margin: 0; padding: 0; border: 0; min-width: 0; display: grid; gap: 8px; }
.rt__chips-legend { padding: 0; margin: 0 0 2px; font-size: 0.85em; font-weight: 600; color: var(--rt-text); }
.rt__order-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.rt__order {
  position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 12px; cursor: pointer;
  border: 1px solid var(--rt-border); border-radius: calc(var(--rt-radius) * 0.8); background: var(--rt-bg);
  transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}
.rt__order:hover { border-color: color-mix(in srgb, var(--rt-text) 35%, var(--rt-border)); }
.rt__order .rt__tick { position: absolute; top: 10px; right: 10px; }
.rt__order:has(input:checked) { border-color: var(--rt-primary); box-shadow: 0 0 0 1px var(--rt-primary); }
.rt__order:has(input:checked) .rt__tick, .rt__item.is-checked .rt__tick { background: var(--rt-primary); border-color: var(--rt-primary); color: var(--rt-primary-text); }
.rt__order:has(input:focus-visible) { outline: 2px solid var(--rt-accent); outline-offset: 3px; }
.rt__order-strip { display: flex; margin-bottom: 8px; }
.rt__order-strip img, .rt__order-empty, .rt__order-more {
  width: 44px; height: 44px; border-radius: 10px; object-fit: cover; border: 2px solid var(--rt-bg);
  background: color-mix(in srgb, var(--rt-border) 45%, var(--rt-bg));
}
.rt__order-strip > * + * { margin-left: -12px; }
.rt__order-more { display: inline-flex; align-items: center; justify-content: center; font-size: 0.75em; font-weight: 600; color: var(--rt-muted); }
.rt__order-name { font-weight: 650; }
.rt__order--other { border-style: dashed; justify-content: center; min-height: 100%; }
.rt__order-plus { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; margin-bottom: 8px; border-radius: 10px; color: var(--rt-muted); background: color-mix(in srgb, var(--rt-border) 30%, var(--rt-bg)); }
.rt__order--other .rt__order-name { font-weight: 500; font-size: 0.93em; }

/* Actions : bouton principal pleine largeur, retour discret. */
.rt__actions { display: grid; justify-items: center; gap: 10px; margin-top: 4px; }
.rt__button {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px; width: 100%; min-height: 52px; padding: 12px 22px;
  font: inherit; font-weight: 600; color: var(--rt-primary-text); background: var(--rt-primary);
  border: 1px solid var(--rt-primary); border-radius: var(--rt-button-radius); cursor: pointer;
  transition: opacity .15s ease, transform .15s ease;
}
.rt__button svg { transition: transform .2s ease; }
.rt__button:hover svg { transform: translateX(3px); }
.rt__button:active { transform: translateY(1px); }
.rt__button:disabled { opacity: .55; cursor: progress; }
.rt__button[aria-busy="true"] svg { animation: rt-nudge .8s ease-in-out infinite; }
@keyframes rt-nudge { 50% { transform: translateX(4px); } }
.rt__back, .rt__add {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; font: inherit; font-size: 0.9em; color: var(--rt-muted);
  background: none; border: 0; border-radius: 999px; cursor: pointer;
}
.rt__back:hover, .rt__add:hover { color: var(--rt-text); background: color-mix(in srgb, var(--rt-border) 35%, transparent); }
.rt__add { color: var(--rt-text); font-weight: 500; padding-left: 4px; }
.rt__link { padding: 0; font: inherit; font-size: 0.93em; color: var(--rt-text); background: none; border: 0; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.rt__button:focus-visible, .rt__link:focus-visible, .rt__back:focus-visible, .rt__add:focus-visible, .rt__copy:focus-visible, .rt__stepper button:focus-visible {
  outline: 2px solid var(--rt-accent); outline-offset: 2px;
}

/* Articles de la commande. */
.rt__order-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.rt__order-head p { margin: 0; }
.rt__items, .rt__manual { display: grid; gap: 10px; list-style: none; margin: 0; padding: 0; }
.rt__item { border: 1px solid var(--rt-border); border-radius: calc(var(--rt-radius) * 0.8); transition: border-color .15s ease, box-shadow .15s ease; }
/* Sélection : un seul contour, épaissi vers l'extérieur (jamais recouvert par le contenu). */
.rt__item:has(.rt__item-main input:focus-visible) { outline: 2px solid var(--rt-accent); outline-offset: 3px; }
.rt__item.is-checked { border-color: var(--rt-primary); box-shadow: 0 0 0 1px var(--rt-primary); }
.rt__item-main { display: flex; align-items: center; gap: 14px; padding: 12px 14px 12px 12px; cursor: pointer; }
.rt__thumb { width: 64px; height: 64px; flex: 0 0 auto; object-fit: cover; border-radius: calc(var(--rt-radius) * 0.55); background: color-mix(in srgb, var(--rt-border) 40%, var(--rt-bg)); }
.rt__thumb--sm { width: 44px; height: 44px; border-radius: 10px; }
.rt__item-label { display: grid; gap: 1px; min-width: 0; flex: 1 1 auto; }
.rt__item-title { font-weight: 600; overflow-wrap: anywhere; }
.rt__item-details { display: grid; gap: 14px; margin: 0 14px; padding: 14px 0; border-top: 1px dashed var(--rt-border); animation: rt-in .25s ease both; }
.rt__qty-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.rt__stepper { display: inline-flex; align-items: center; gap: 4px; padding: 3px; border: 1px solid var(--rt-border); border-radius: 999px; background: var(--rt-bg); }
.rt__stepper button { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; padding: 0; border: 0; border-radius: 50%; background: none; color: var(--rt-text); cursor: pointer; }
.rt__stepper button:hover:not(:disabled) { background: color-mix(in srgb, var(--rt-border) 45%, transparent); }
.rt__stepper button:disabled { opacity: .3; cursor: default; }
.rt__stepper output { min-width: 3.2em; text-align: center; font-weight: 600; font-variant-numeric: tabular-nums; }
.rt__switch { margin: 0; }

/* Motifs en pastilles. */
.rt__chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; border: 0; min-width: 0; }
.rt__chips .rt__chips-legend { width: 100%; margin-bottom: 4px; }
.rt__chip { position: relative; display: inline-flex; cursor: pointer; }
.rt__chip input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.rt__chip span {
  display: inline-flex; align-items: center; padding: 7px 12px; font-size: 0.9em; line-height: 1.2; border-radius: 999px;
  border: 1px solid var(--rt-border); background: var(--rt-bg); transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.rt__chip:hover span { border-color: color-mix(in srgb, var(--rt-text) 35%, var(--rt-border)); }
.rt__chip input:checked + span { background: var(--rt-text); border-color: var(--rt-text); color: var(--rt-bg); }
.rt__chip input:focus-visible + span { outline: 2px solid var(--rt-accent); outline-offset: 2px; }

/* Saisie manuelle. */
.rt__manual-row { display: grid; gap: 12px; padding: 14px; border: 1px solid var(--rt-border); border-radius: calc(var(--rt-radius) * 0.8); }
.rt__manual-fields { display: grid; grid-template-columns: 1fr 110px; gap: 10px; }
.rt__remove { justify-self: start; font-size: 0.85em; color: var(--rt-muted); }

/* Récapitulatif façon reçu. */
.rt__receipt { border: 1px solid var(--rt-border); border-radius: calc(var(--rt-radius) * 0.8); overflow: hidden; }
.rt__receipt-head { display: grid; gap: 8px; margin: 0; padding: 14px 16px; background: color-mix(in srgb, var(--rt-border) 18%, var(--rt-bg)); }
.rt__receipt-head > div { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: 0.93em; }
.rt__receipt-head dt { color: var(--rt-muted); }
.rt__receipt-head dd { margin: 0; font-weight: 500; text-align: right; overflow-wrap: anywhere; }
.rt__receipt-items { list-style: none; margin: 0; padding: 6px 16px; border-top: 1px dashed var(--rt-border); }
.rt__receipt-items li { display: flex; align-items: center; gap: 12px; padding: 10px 0; }
.rt__receipt-items li + li { border-top: 1px solid color-mix(in srgb, var(--rt-border) 60%, var(--rt-bg)); }
.rt__receipt-text { display: grid; gap: 1px; flex: 1 1 auto; min-width: 0; }
.rt__receipt-qty { font-weight: 600; font-variant-numeric: tabular-nums; }
.rt__receipt-total { display: flex; justify-content: space-between; padding: 12px 16px; border-top: 1px dashed var(--rt-border); font-size: 0.93em; }
.rt__receipt-comment { display: grid; gap: 2px; margin: 0; padding: 12px 16px; border-top: 1px dashed var(--rt-border); font-size: 0.93em; white-space: pre-wrap; }
.rt__legal { display: flex; gap: 10px; align-items: flex-start; margin: 0; font-size: 0.85em; line-height: 1.5; color: var(--rt-muted); }
.rt__legal svg { flex: 0 0 auto; margin-top: 2px; color: var(--rt-accent); }

/* Écran final. */
.rt[data-step="success"] .rt__intro { display: none; }
.rt__success { display: grid; justify-items: center; gap: 10px; text-align: center; animation: rt-in .35s ease both; }
.rt__success-mark { color: var(--rt-primary); }
.rt__success-mark circle { stroke-dasharray: 145; stroke-dashoffset: 145; animation: rt-draw .6s ease forwards; }
.rt__success-mark path { stroke-dasharray: 32; stroke-dashoffset: 32; animation: rt-draw .35s .45s ease forwards; }
@keyframes rt-draw { to { stroke-dashoffset: 0; } }
.rt__success-text { margin: 0; max-width: 46ch; color: var(--rt-muted); }
.rt__reference { display: inline-flex; align-items: center; gap: 10px; margin-top: 6px; padding: 6px 6px 6px 14px; border: 1px solid var(--rt-border); border-radius: 999px; }
.rt__reference-code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-weight: 600; letter-spacing: .04em; }
.rt__copy { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; padding: 0; border: 0; border-radius: 50%; background: color-mix(in srgb, var(--rt-border) 35%, var(--rt-bg)); color: var(--rt-text); cursor: pointer; transition: background .15s ease; }
.rt__copy.is-copied { background: var(--rt-primary); color: var(--rt-primary-text); }
.rt__success-date { margin: 0; font-size: 0.82em; }
.rt__next { width: 100%; margin-top: 10px; padding: 16px; text-align: left; border-radius: calc(var(--rt-radius) * 0.8); background: color-mix(in srgb, var(--rt-border) 18%, var(--rt-bg)); }
.rt__timeline { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 0; }
.rt__timeline li { position: relative; display: flex; gap: 12px; align-items: flex-start; padding-bottom: 14px; font-size: 0.93em; }
.rt__timeline li:last-child { padding-bottom: 0; }
.rt__timeline li:not(:last-child)::before { content: ""; position: absolute; left: 10px; top: 24px; bottom: 2px; width: 1.5px; background: var(--rt-border); }
.rt__dot { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; flex: 0 0 auto; border-radius: 50%; border: 1.5px solid var(--rt-border); background: var(--rt-bg); color: var(--rt-primary-text); }
.rt__timeline li.is-done .rt__dot { background: var(--rt-primary); border-color: var(--rt-primary); }
.rt__timeline li > span:last-child { padding-top: 2px; }

.rt__branding { display: flex; align-items: center; justify-content: center; gap: 6px; margin: 22px 0 0; font-size: 0.75em; color: var(--rt-muted); }
.rt__skeleton { height: 260px; border-radius: calc(var(--rt-radius) * 0.75); background: linear-gradient(90deg, color-mix(in srgb, var(--rt-border) 25%, transparent), color-mix(in srgb, var(--rt-border) 55%, transparent), color-mix(in srgb, var(--rt-border) 25%, transparent)); background-size: 200% 100%; animation: rt-shimmer 1.2s linear infinite; }
@keyframes rt-shimmer { to { background-position: -200% 0; } }

@media (max-width: 520px) {
  .rt { border-radius: calc(var(--rt-radius) * 0.66); }
  .rt__grid { grid-template-columns: 1fr; }
  .rt__order-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rt__manual-fields { grid-template-columns: 1fr 90px; }
  .rt__qty-row { flex-wrap: wrap; }
}
@media (prefers-reduced-motion: reduce) {
  .rt__form, .rt__success, .rt__item-details, .rt__skeleton, .rt__success-mark circle, .rt__success-mark path { animation: none; }
  .rt__success-mark circle, .rt__success-mark path { stroke-dashoffset: 0; }
  .rt__bar::after { transition: none; }
}

/* ---------- Bouton et lien d'accès au formulaire ---------- */
.rt-trigger {
  display: inline-flex; align-items: center; gap: 8px; padding: 10px 16px;
  font-family: var(--rt-font, inherit); font-size: 14px; font-weight: 600; line-height: 1.2;
  color: var(--rt-primary-text, #fff); background: var(--rt-primary, #111); border-radius: var(--rt-button-radius, 999px);
  text-decoration: none; box-shadow: 0 4px 18px rgba(0, 0, 0, .18);
}
.rt-trigger:hover { opacity: .92; }
.rt-trigger:focus-visible { outline: 2px solid var(--rt-accent, #1f5eff); outline-offset: 3px; }
.rt-trigger--floating { position: fixed; z-index: 60; bottom: var(--rt-offset-y, 20px); }
.rt-trigger--left { left: var(--rt-offset-x, 20px); }
.rt-trigger--right { right: var(--rt-offset-x, 20px); }
.rt-trigger--link { padding: 0; color: inherit; background: none; box-shadow: none; font-weight: inherit; text-decoration: underline; text-underline-offset: 3px; }
.rt-trigger svg { flex: 0 0 auto; }
@media (max-width: 480px) {
  .rt-trigger--floating { font-size: 13px; padding: 9px 13px; }
}
