/* ============================================================
   Authentication — PRT public shell
   Landing identity translated into an accessible, lightweight UI.
   ============================================================ */

/* Charte graphite/argent (QA16). Le panneau du globe reste graphite dans les
   deux thèmes, comme la barre latérale du portail. */
.auth-page {
  --auth-night: #181818;
  --auth-night-raised: #1e1e1e;
  --auth-on-night: #f2f2f2;
  --auth-muted-night: #9c9c9c;
  --auth-silver: #d7dde1;
  --auth-line-strong: rgba(208, 208, 208, .28);
  /* Recalculés ici : hérités de <html>, ils ignoreraient l'accent de l'auth en sombre. */
  --focus: var(--signal-azure);
  --focus-ring: 0 0 0 2px var(--surface), 0 0 0 4px var(--focus);
  /* « … Fallback » : replis locaux recalés sur la police attendue (includes/public_head_fonts.html). */
  --font-sans: 'IBM Plex Sans', 'IBM Plex Sans Fallback', 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'IBM Plex Mono', 'IBM Plex Mono Fallback', 'SFMono-Regular', Consolas, monospace;
  --font-display: 'Bricolage Grotesque', 'Bricolage Grotesque Fallback', 'IBM Plex Sans', 'Segoe UI', system-ui, sans-serif;
  min-width: 320px;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  background:
    radial-gradient(circle at 14% 12%, rgba(69, 69, 69, .34), transparent 30rem),
    linear-gradient(rgba(208, 208, 208, .035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(208, 208, 208, .035) 1px, transparent 1px),
    var(--auth-night);
  background-size: auto, 72px 72px, 72px 72px, auto;
  color: var(--ink-default);
}

/* Le portail garde son bleu et ses encres bleutées : l'auth les remplace par
   le graphite du logo (accent du thème clair). */
[data-layout-mode="light"].auth-page,
[data-layout-mode="light"] .auth-page {
  --signal-azure: #181818;
  --signal-azure-deep: #222222;
  --signal-azure-soft: #efefef;
  --on-azure: #ffffff;
  --ink-strong: #181818;
  --ink-default: #2e2e2e;
  --ink-muted: #5e5e5e;
  --border-control: #858585;
}

/* En sombre, l'accent est l'argent du logo. */
[data-layout-mode="dark"].auth-page,
[data-layout-mode="dark"] .auth-page {
  --signal-azure: #d7dde1;
  --signal-azure-deep: #c3ccd2;
}

.auth-page a,
.auth-page button,
.auth-page input {
  -webkit-tap-highlight-color: transparent;
}

.auth-page .skip-link {
  z-index: 1000;
}

/* Icônes SVG en ligne (includes/public_icons) : la boîte du glyphe de police qu'elles remplacent, ligne de base comprise. */
.auth-page .rs-icon {
  vertical-align: -.125em;
}

.auth-shell {
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(420px, 42vw, 720px);
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background: var(--surface);
  box-shadow: none;
}

/* ---- Brand context --------------------------------------------------- */

.auth-context {
  position: relative;
  isolation: isolate;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding-top: max(clamp(var(--space-xl), 4vw, var(--space-3xl)), env(safe-area-inset-top, 0px));
  padding-right: max(clamp(var(--space-xl), 4vw, var(--space-3xl)), env(safe-area-inset-right, 0px));
  padding-bottom: max(clamp(var(--space-xl), 4vw, var(--space-3xl)), env(safe-area-inset-bottom, 0px));
  padding-left: max(clamp(var(--space-xl), 4vw, var(--space-3xl)), env(safe-area-inset-left, 0px));
  overflow: hidden;
  color: var(--auth-on-night);
  background:
    radial-gradient(circle at 76% 50%, rgba(69, 69, 69, .56), transparent 17rem),
    radial-gradient(circle at 68% 56%, rgba(184, 184, 184, .06), transparent 26rem),
    linear-gradient(145deg, var(--auth-night-raised), var(--auth-night) 72%);
}

.auth-context::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    linear-gradient(rgba(208, 208, 208, .025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(208, 208, 208, .025) 1px, transparent 1px);
  background-size: 72px 72px;
}

.auth-context::after {
  content: "";
  position: absolute;
  right: -12rem;
  bottom: -13rem;
  z-index: -2;
  width: 32rem;
  height: 32rem;
  border: 1px solid rgba(184, 184, 184, .12);
  border-radius: 50%;
  box-shadow: 0 0 0 5rem rgba(69, 69, 69, .12), 0 0 0 10rem rgba(69, 69, 69, .08);
}

.auth-page .lp .globe-callout--origin {
  --callout-accent: var(--auth-silver);
  --callout-glow: rgba(69, 69, 69, .55);
}

.auth-page .lp .globe-callout--delivery,
.auth-page .lp .globe-callout--client {
  --callout-accent: var(--auth-on-night);
  --callout-glow: rgba(69, 69, 69, .44);
}

.auth-page .lp .globe-callout__title {
  color: var(--auth-on-night);
}

.auth-page .lp .globe-callout__subtitle {
  color: var(--auth-muted-night);
}

.auth-page .lp .globe-callout__surface,
.auth-page .lp .globe-callout--delivery .globe-callout__surface {
  border-color: rgba(184, 184, 184, .24);
}

.auth-context__brand {
  display: inline-flex;
  align-items: center;
  gap: 13px;
  width: fit-content;
  color: var(--auth-on-night);
  line-height: 1;
  text-decoration: none;
}

.auth-context__logo {
  display: block;
  width: auto;
  height: 44px;
  border-radius: var(--r-sm);
  transition: transform var(--dur-slow) var(--ease);
}

.auth-context__brand:hover .auth-context__logo {
  transform: translateY(-1px);
}

.auth-brand__product {
  padding-left: 14px;
  border-left: 1px solid var(--auth-line-strong);
  color: var(--auth-muted-night);
  font-family: var(--font-mono);
  font-size: var(--text-caption);
  font-style: normal;
  font-weight: 600;
  letter-spacing: .15em;
}

.auth-context__copy {
  position: relative;
  z-index: 2;
  max-width: 30rem;
  margin-top: clamp(70px, 13vh, 130px);
}

.auth-head__kicker {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  color: var(--signal-azure-deep);
  font-family: var(--font-mono);
  font-size: var(--text-caption);
  font-weight: var(--weight-semibold);
  letter-spacing: .1em;
  text-transform: uppercase;
}

.auth-head__kicker::before {
  content: "";
  width: 18px;
  height: 1px;
  margin-right: 9px;
  background: currentColor;
}

.auth-context__title {
  max-width: 11ch;
  margin: 16px 0 18px;
  color: var(--auth-on-night);
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 4.8vw, 4.6rem);
  font-weight: var(--weight-bold);
  letter-spacing: -.045em;
  line-height: .96;
}

.auth-context__lead {
  max-width: 39ch;
  margin: 0;
  color: var(--auth-on-night);
  font-size: var(--text-body);
  font-weight: var(--weight-regular);
  letter-spacing: .005em;
  line-height: var(--leading-reading);
}

/* ---- Functional panel ------------------------------------------------ */

.auth-panel {
  min-width: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-rows: auto 1fr;
  border-left: 1px solid var(--border-hairline);
  background: var(--surface);
}

.auth-panel__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  padding-right: max(clamp(var(--space-lg), 4vw, var(--space-2xl)), env(safe-area-inset-right, 0px));
  padding-left: max(clamp(var(--space-lg), 4vw, var(--space-2xl)), env(safe-area-inset-left, 0px));
}

.auth-panel__top {
  min-height: 72px;
  padding-top: env(safe-area-inset-top, 0px);
  border-bottom: 1px solid var(--border-hairline);
  background: color-mix(in oklch, var(--signal-azure-soft) 18%, var(--surface));
}

.auth-panel__product {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--ink-muted);
  font-size: var(--text-caption);
  font-weight: 600;
}

.auth-panel__product > span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--signal-azure);
  box-shadow: 0 0 0 4px var(--signal-azure-soft);
}

.auth-panel__body {
  width: 100%;
  display: grid;
  place-items: center;
  padding: clamp(var(--space-xl), 6vw, 70px) clamp(var(--space-lg), 6vw, var(--space-3xl));
  padding-right: max(clamp(var(--space-lg), 6vw, var(--space-3xl)), env(safe-area-inset-right, 0px));
  padding-left: max(clamp(var(--space-lg), 6vw, var(--space-3xl)), env(safe-area-inset-left, 0px));
}

/* ---- Form content ----------------------------------------------------- */

.auth-card {
  width: min(100%, 480px);
}

.auth-head {
  margin-bottom: var(--space-xl);
}

.auth-head__icon,
.auth-result {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  margin-bottom: 20px;
  border: 1px solid color-mix(in srgb, var(--signal-azure) 22%, var(--border-hairline));
  border-radius: var(--r-lg);
  background: var(--signal-azure-soft);
  color: var(--signal-azure-deep);
  font-size: var(--text-heading);
}

.auth-title {
  margin: 8px 0 9px;
  color: var(--ink-strong);
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: var(--weight-bold);
  letter-spacing: -.035em;
  line-height: 1.08;
}

.auth-head > .auth-title:first-child {
  margin-top: 0;
}

.auth-sub {
  max-width: 44ch;
  margin: 0;
  color: var(--ink-muted);
  font-size: var(--text-body);
  line-height: var(--leading-body);
}

.auth-card--message {
  text-align: center;
}

.auth-card--message .auth-result {
  margin-inline: auto;
}

.auth-result {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  font-size: var(--text-data);
}

/* ---- Fields ----------------------------------------------------------- */

.field {
  margin-bottom: 18px;
}

.field-label {
  display: inline-block;
  margin-bottom: 7px;
  color: var(--ink-default);
  font-size: var(--text-meta);
  font-weight: var(--weight-semibold);
}

.field-input {
  position: relative;
}

.field-input input {
  width: 100%;
  height: 50px;
  padding: 0 46px 0 43px;
  border: 1px solid var(--border-control);
  border-radius: var(--r-md);
  outline: none;
  background: var(--surface);
  color: var(--ink-strong);
  font: inherit;
  font-size: var(--text-body);
  transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease);
}

.field-input input:hover {
  border-color: color-mix(in srgb, var(--signal-azure) 38%, var(--border-control));
}

.field-input input:focus {
  border-color: var(--signal-azure);
  background: var(--surface);
  box-shadow: 0 0 0 1px var(--signal-azure);
}

.auth-page .field-input input:-webkit-autofill,
.auth-page .field-input input:-webkit-autofill:hover,
.auth-page .field-input input:-webkit-autofill:focus,
.auth-page .field-input input:-webkit-autofill:active {
  -webkit-text-fill-color: var(--ink-strong);
  -webkit-box-shadow: 0 0 0 1000px var(--surface) inset;
  box-shadow: 0 0 0 1000px var(--surface) inset;
  caret-color: var(--ink-strong);
}

.auth-page .field-input input:-webkit-autofill:focus {
  border-color: var(--signal-azure);
  -webkit-box-shadow: 0 0 0 1000px var(--surface) inset, 0 0 0 1px var(--signal-azure);
  box-shadow: 0 0 0 1000px var(--surface) inset, 0 0 0 1px var(--signal-azure);
}

/* Champ refusé (form-errors.js pose aria-invalid) : même marque qu'un .ds-input, focalisé ou non. */
.field-input input[aria-invalid="true"] {
  border-color: var(--red);
  box-shadow: 0 0 0 3px var(--red-soft);
}

.auth-page .field-input input[aria-invalid="true"]:-webkit-autofill {
  border-color: var(--red);
  -webkit-box-shadow: 0 0 0 1000px var(--surface) inset, 0 0 0 3px var(--red-soft);
  box-shadow: 0 0 0 1000px var(--surface) inset, 0 0 0 3px var(--red-soft);
}

.field-input input::placeholder {
  color: color-mix(in srgb, var(--ink-muted) 78%, transparent);
}

/* Grille : l'icône est centrée par sa boîte, pas posée sur la ligne de base,
   dont la hauteur change d'une police à l'autre (1 px trop haut en IBM Plex). */
.field-icon {
  position: absolute;
  top: 50%;
  left: 15px;
  display: grid;
  place-items: center;
  color: var(--ink-muted);
  font-size: var(--text-section);
  pointer-events: none;
  transform: translateY(-50%);
  transition: color var(--dur-fast) var(--ease);
}

.field-input input:focus ~ .field-icon {
  color: var(--signal-azure);
}

.pwd-toggle,
.password-toggle {
  position: absolute;
  top: 50%;
  right: 3px;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--ink-muted);
  cursor: pointer;
  transform: translateY(-50%);
}

.pwd-toggle:hover,
.password-toggle:hover {
  background: var(--surface-sunken);
  color: var(--ink-strong);
}

/* Le bouton porte les deux yeux ; aria-pressed (posé par le script) choisit le tracé. */
:is(.pwd-toggle, .password-toggle)[aria-pressed="true"] .rs-icon[data-icon="eye-outline"],
:is(.pwd-toggle, .password-toggle):not([aria-pressed="true"]) .rs-icon[data-icon="eye-off-outline"] {
  display: none;
}

.field-foot,
.forgot-actions {
  display: flex;
  justify-content: flex-end;
  margin: -4px 0 20px;
}

.forgot-actions {
  justify-content: center;
  margin: 18px 0 0;
}

.auth-link-button,
.link-back {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  gap: 6px;
  padding: 6px 4px;
  border: 0;
  background: transparent;
  color: var(--signal-azure-deep);
  font: inherit;
  font-size: var(--text-meta);
  font-weight: var(--weight-semibold);
  text-decoration: none;
  cursor: pointer;
}

.auth-link-button:hover,
.link-back:hover {
  color: var(--signal-azure);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.link-back {
  width: fit-content;
  margin: 20px auto 0;
}

.btn-submit {
  position: relative;
  width: 100%;
  min-height: 50px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 0 22px;
  overflow: hidden;
  border: 1px solid var(--action-fill);
  border-radius: var(--r-md);
  background: var(--action-fill);
  color: var(--on-action);
  box-shadow: 0 5px 12px color-mix(in oklch, var(--action-fill) 12%, transparent);
  font: inherit;
  font-size: var(--text-control);
  font-weight: var(--weight-semibold);
  text-decoration: none;
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
}

.btn-submit:hover {
  border-color: var(--action-fill-hover);
  background: var(--action-fill-hover);
  color: var(--on-action);
  box-shadow: 0 10px 22px color-mix(in srgb, var(--action-fill) 25%, transparent);
  transform: translateY(-2px);
}

.btn-submit:active {
  transform: translateY(0);
}

.btn-submit:disabled {
  opacity: .58;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

.spin {
  position: absolute;
  width: 18px;
  height: 18px;
  display: none;
  border: 2px solid color-mix(in srgb, var(--on-azure) 32%, transparent);
  border-top-color: var(--on-azure);
  border-radius: 50%;
  animation: ds-spin .72s linear infinite;
}

/* Envoi en attente (button-state.js) : le libellé dit ce qui se passe, la roue
   prend la place de l'icône. */
.btn-submit[aria-busy="true"] {
  cursor: progress;
}

.btn-submit[aria-busy="true"]:hover {
  transform: none;
}

.btn-submit[aria-busy="true"] .btn-ic {
  display: none;
}

.btn-submit[aria-busy="true"] .spin {
  position: static;
  display: block;
}

/* ---- Feedback --------------------------------------------------------- */

/* Sans message, la région ne porte que l'annonce d'un bouton occupé
   (data-live-region) : lue par le lecteur d'écran, jamais affichée. */
.auth-alerts:not(:has(> .alert)) {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.auth-alerts:has(> .alert) {
  display: grid;
  gap: 8px;
  margin-bottom: 18px;
}

.auth-card .alert {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin: 0;
  padding: 11px 13px;
  border: 1px solid transparent;
  border-radius: var(--r-md);
  font-size: var(--text-control);
  line-height: var(--leading-ui);
}

.auth-card .alert i {
  flex: 0 0 auto;
  margin-top: 1px;
  font-size: var(--text-body);
}

.auth-card .alert-error {
  border-color: color-mix(in srgb, var(--red) 24%, var(--border-hairline));
  background: var(--red-soft);
  color: var(--red-text);
}

.auth-card .alert-success {
  border-color: var(--border-strong);
  background: var(--surface-sunken);
  color: var(--ink-strong);
}

.auth-card.shake {
  animation: auth-invalid var(--dur-slow) var(--ease) 1;
}

@keyframes auth-invalid {
  0%, 100% { transform: translateX(0); }
  35% { transform: translateX(-4px); }
  70% { transform: translateX(4px); }
}

.auth-is-hidden {
  display: none !important;
}

.auth-switch {
  animation: auth-switch-in var(--dur-base) var(--ease) both;
}

@keyframes auth-switch-in {
  from { transform: translateY(6px); }
  to { transform: translateY(0); }
}

/* ---- Password guidance ------------------------------------------------ */

.password-rules {
  margin: 2px 0 22px;
  padding: 13px;
  border: 1px solid var(--border-hairline);
  border-radius: var(--r-md);
  background: var(--surface-sunken);
}

.password-rules__track {
  height: 3px;
  margin-bottom: 11px;
  overflow: hidden;
  border-radius: var(--r-pill);
  background: var(--border-strong);
}

.password-rules__track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--signal-azure);
  transition: width var(--dur-base) var(--ease), background var(--dur-fast) var(--ease);
}

.password-rules ul {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.password-rules li {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--ink-muted);
  font-size: var(--text-caption);
}

.password-rules li.is-valid {
  color: var(--ink-strong);
}

.password-rules li:not(.is-valid) .rs-icon[data-icon="check"],
.password-rules li.is-valid .rs-icon[data-icon="circle-outline"] {
  display: none;
}

/* ---- OTP -------------------------------------------------------------- */

.auth-card--otp .auth-head {
  text-align: left;
}

.otp-timer {
  width: fit-content;
  display: flex;
  align-items: center;
  gap: 7px;
  margin: -8px 0 18px;
  color: var(--ink-muted);
  font-family: var(--font-mono);
  font-size: var(--text-caption);
}

.otp-timer__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--signal-azure);
}

.otp-timer.is-critical {
  color: var(--red-text);
}

.otp-timer.is-critical .otp-timer__dot {
  background: var(--red);
}

.otp-fieldset {
  min-width: 0;
  margin: 0 0 24px;
  padding: 0;
  border: 0;
}

.otp-boxes {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)) 12px repeat(3, minmax(0, 1fr));
  align-items: center;
  gap: 8px;
}

.otp-box {
  min-width: 0;
  width: 100%;
  height: 58px;
  padding: 0;
  border: 1px solid var(--border-control);
  border-radius: var(--r-md);
  outline: none;
  background: var(--surface-sunken);
  color: var(--ink-strong);
  font-family: var(--font-mono);
  font-size: var(--text-heading);
  font-weight: var(--weight-semibold);
  text-align: center;
  caret-color: var(--signal-azure);
  transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
}

.otp-box:hover {
  border-color: color-mix(in srgb, var(--signal-azure) 38%, var(--border-control));
}

.otp-box:focus {
  border-color: var(--signal-azure);
  background: var(--surface);
  box-shadow: 0 0 0 1px var(--signal-azure);
  transform: translateY(-1px);
}

.otp-box.filled {
  border-color: color-mix(in srgb, var(--signal-azure) 55%, var(--border-control));
  background: var(--signal-azure-soft);
}

.otp-separator {
  width: 8px;
  height: 1px;
  justify-self: center;
  background: var(--border-strong);
}

/* ---- Keyboard focus --------------------------------------------------- */

/* Focus double : un liseré de la surface contre l'élément, puis --focus autour.
   L'un des deux tranche sur le panneau, sur le bouton plein et sur le graphite du globe. */
.auth-page :is(a, button):focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  box-shadow: 0 0 0 2px var(--surface);
}

/* ---- Responsive ------------------------------------------------------- */

@media (max-width: 960px) {
  .auth-shell {
    width: 100%;
    min-height: 100vh;
    min-height: 100dvh;
    grid-template-columns: 1fr;
    overflow: visible;
  }

  .auth-context {
    min-height: clamp(340px, 42vh, 460px);
    min-height: clamp(340px, 42dvh, 460px);
    padding: var(--space-xl);
  }

  .auth-context__copy {
    max-width: 26rem;
    margin-top: 50px;
  }

  .auth-context__title {
    max-width: 13ch;
    font-size: clamp(2.3rem, 8vw, 3.3rem);
  }

  .auth-context__lead {
    max-width: 34ch;
  }

  .auth-panel__body {
    min-height: auto;
  }

  .auth-panel {
    min-height: 58vh;
    min-height: 58dvh;
    border-top: 1px solid var(--border-hairline);
    border-left: 0;
  }
}

@media (max-width: 640px) {
  .auth-shell {
    width: 100%;
    min-height: 100vh;
    min-height: 100dvh;
    margin: 0;
    border: 0;
    border-radius: 0;
  }

  .auth-context {
    min-height: clamp(300px, 43vh, 380px);
    min-height: clamp(300px, 43dvh, 380px);
    padding-top: max(var(--space-lg), env(safe-area-inset-top, 0px));
    padding-right: max(var(--space-lg), env(safe-area-inset-right, 0px));
    padding-bottom: max(var(--space-lg), env(safe-area-inset-bottom, 0px));
    padding-left: max(var(--space-lg), env(safe-area-inset-left, 0px));
  }

  .auth-context::before {
    inset: 0;
  }

  .auth-context__copy {
    margin-top: 36px;
  }

  .auth-context__title {
    max-width: 15ch;
    margin-block: 10px 0;
    font-size: clamp(2rem, 10vw, 2.7rem);
  }

  .auth-context__lead {
    display: none;
  }

  .auth-panel__top {
    padding-right: max(var(--space-lg), env(safe-area-inset-right, 0px));
    padding-left: max(var(--space-lg), env(safe-area-inset-left, 0px));
  }

  .auth-panel__body {
    min-height: auto;
    place-items: start stretch;
    padding-top: var(--space-2xl);
    padding-right: max(var(--space-lg), env(safe-area-inset-right, 0px));
    padding-bottom: var(--space-2xl);
    padding-left: max(var(--space-lg), env(safe-area-inset-left, 0px));
  }

  .auth-card {
    width: 100%;
    max-width: 500px;
    margin-inline: auto;
  }

}

@media (max-width: 430px) {
  /* Le décor se réduit à un bandeau (logo et globe). */
  .auth-context {
    min-height: 0;
    padding-top: max(12px, env(safe-area-inset-top, 0px));
    padding-bottom: 12px;
  }

  .auth-context__copy,
  .auth-page .lp .globe-callout,
  .auth-head__icon {
    display: none;
  }

  .auth-panel__top {
    min-height: 52px;
  }

  .auth-head {
    margin-bottom: var(--space-md);
  }

  .auth-brand__product {
    display: none;
  }

  .password-rules ul {
    grid-template-columns: 1fr;
  }

  .auth-panel__body {
    padding-top: var(--space-md);
    padding-right: max(12px, env(safe-area-inset-right, 0px));
    padding-left: max(12px, env(safe-area-inset-left, 0px));
  }

  .otp-boxes {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 5px;
  }

  .otp-separator {
    display: none;
  }

  .otp-box {
    height: 52px;
    border-radius: var(--r-sm);
    font-size: var(--text-section);
  }
}

/* Téléphone court (jusqu'à 320 × 568) : le bouton d'envoi tient dans l'écran sans défiler,
   y compris sous les deux champs et les cinq règles du nouveau mot de passe. */
@media (max-width: 430px) and (max-height: 640px) {
  .auth-context {
    padding-top: max(8px, env(safe-area-inset-top, 0px));
    padding-bottom: 8px;
  }

  .auth-context__logo {
    height: 32px;
  }

  /* Le bouton de pause (44 px) tient dans le bandeau de 48 px au lieu d'en déborder. */
  .auth-page .lp-scene-pause {
    bottom: 2px;
  }

  .auth-panel__top {
    min-height: 44px;
  }

  .auth-title {
    font-size: 1.625rem;
  }

  .auth-sub {
    font-size: var(--text-meta);
  }

  .auth-head {
    margin-bottom: var(--space-sm);
  }

  .field {
    margin-bottom: var(--space-sm);
  }

  .field-label {
    margin-bottom: 4px;
  }

  .field-input input {
    height: 44px;
  }

  .btn-submit {
    min-height: 44px;
  }

  .password-rules {
    margin: 0 0 var(--space-sm);
    padding: 10px;
  }

  /* Les règles se suivent sur la ligne au lieu d'en prendre une chacune. */
  .password-rules ul {
    display: flex;
    flex-wrap: wrap;
  }
}

/* Landscape rules follow the width rules so short viewports win the cascade. */
@media (min-width: 560px) and (max-width: 960px) and (max-height: 600px) and (orientation: landscape) {
  .auth-shell {
    grid-template-columns: minmax(200px, .65fr) minmax(340px, 1.35fr);
    overflow: hidden;
  }

  .auth-context,
  .auth-panel {
    min-height: 100vh;
    min-height: 100dvh;
  }

  .auth-context {
    padding-top: max(18px, env(safe-area-inset-top, 0px));
    padding-right: 18px;
    padding-bottom: max(18px, env(safe-area-inset-bottom, 0px));
    padding-left: max(18px, env(safe-area-inset-left, 0px));
  }

  .auth-context__copy {
    margin-top: clamp(24px, 8vh, 46px);
  }

  .auth-context__title {
    max-width: 10ch;
    font-size: clamp(1.65rem, 4vw, 2.4rem);
  }

  .auth-context__lead {
    display: none;
  }

  .auth-panel {
    border-top: 0;
    border-left: 1px solid var(--border-hairline);
  }

  .auth-panel__top {
    min-height: 60px;
  }

  .auth-panel__body {
    min-height: 0;
    place-items: center;
    padding-top: 18px;
    padding-right: max(24px, env(safe-area-inset-right, 0px));
    padding-bottom: 18px;
    padding-left: 24px;
    overflow-y: auto;
  }

}

@media (max-width: 559px) and (max-height: 480px) and (orientation: landscape) {
  .auth-context {
    min-height: 104px;
    padding-top: max(14px, env(safe-area-inset-top, 0px));
    padding-right: max(16px, env(safe-area-inset-right, 0px));
    padding-bottom: 14px;
    padding-left: max(16px, env(safe-area-inset-left, 0px));
  }

  .auth-context__copy,
  .auth-sub {
    display: none;
  }

  .auth-panel {
    min-height: calc(100vh - 104px);
    min-height: calc(100dvh - 104px);
  }

  .auth-panel__top {
    min-height: 52px;
  }

  .auth-panel__body {
    min-height: 0;
    padding: 16px max(16px, env(safe-area-inset-right, 0px)) 16px max(16px, env(safe-area-inset-left, 0px));
    overflow-y: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  .auth-switch,
  .auth-card.shake {
    animation: none !important;
  }

  .auth-page :is(a, button, input),
  .password-rules__track span {
    transition: none !important;
  }

  .auth-context__logo {
    transform: none !important;
    transition: none !important;
  }
}

/* Même rendu que components.css : le shell public ne charge pas cette feuille. */
.ds-field-error { display: block; margin: 5px 0 0; font-size: var(--text-caption); color: var(--red-text); }
.ds-form-summary {
  margin-bottom: 16px; padding: 12px 14px; border: 1px solid color-mix(in oklch, var(--red) 18%, var(--border-hairline));
  border-radius: var(--r-md); background: var(--red-soft); color: var(--red-text);
}
.ds-form-summary:focus-visible { box-shadow: var(--focus-ring); }
.ds-form-summary__title { margin: 0 0 6px; font-weight: var(--weight-semibold); }
.ds-form-summary__list { margin: 0; padding-left: 18px; }
.ds-form-summary__list a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.ds-field-error[hidden], .ds-form-summary[hidden] { display: none; }

/* ---- Motion -------------------------------------------------------------- */

/* L'auth ne charge pas motion.css : son mouvement vit ici (images clés : tokens.css). */
@media (prefers-reduced-motion: no-preference) {
  .auth-context {
    animation: ds-motion-fade-in var(--dur-slow) var(--ease) both;
  }

  .auth-card {
    animation: ds-motion-rise-in var(--dur-slow) var(--ease-quint) both;
  }

  .auth-card .alert {
    animation: ds-motion-state-in var(--dur-slow) var(--ease-quint) both;
  }
}

.auth-page .btn-submit {
  transition-timing-function: var(--ease);
}

.auth-page .btn-submit:not(:disabled):active {
  transform: translateY(1px) scale(.99);
}

@media (prefers-reduced-motion: reduce) {
  .auth-page,
  .auth-page *,
  .auth-page *::before,
  .auth-page *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    animation-delay: 0ms !important;
    transition-duration: .01ms !important;
    transition-delay: 0ms !important;
  }

  .auth-page .btn-submit {
    transform: none !important;
  }

  .auth-page :is(a, button, input) {
    transition-property: color, background-color, border-color, box-shadow, opacity !important;
    transition-duration: var(--dur-fast) !important;
    transition-timing-function: var(--ease) !important;
  }

  .spin {
    animation: ds-motion-essential-pulse 1.4s ease-in-out infinite !important;
  }
}

/* ---- Scene (observatory.css garde la scène commune avec la vitrine) ------ */

.auth-page .auth-globe-stage{
  position:absolute;z-index:0;inset:0;width:auto;height:auto;overflow:hidden;isolation:isolate;transform:none;pointer-events:none;
  background:
    radial-gradient(ellipse 48% 48% at 50% 50%,rgba(215,221,225,.14),transparent 68%),
    radial-gradient(ellipse 68% 66% at 50% 50%,rgba(255,255,255,.04),transparent 72%),var(--universe-bg);
}
.auth-page .auth-context__brand{position:relative;z-index:2;}
.auth-page.scene-off #lp-scene{background:radial-gradient(circle at 52% 52%,rgba(50,54,60,.62),rgba(8,10,14,0) 68%);}
