:root {
  --ink: #163a5c;
  --ink-soft: #1f4f7a;
  --brand: #3d8fc4;
  --brand-deep: #2a6fa0;
  --lagoon: #2f9d78;
  --accent: #f0a12a;
  --mist: #f2f7fb;
  --line: rgba(22, 58, 92, 0.14);
  --danger: #b42318;
  --danger-bg: #fef3f2;
  --radius: 10px;
  --font-display: "Syne", sans-serif;
  --font-body: "Outfit", sans-serif;
  --page-h: 100vh;
  --page-h: 100dvh;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: var(--page-h);
  max-height: var(--page-h);
  overflow: hidden;
}

body {
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--mist);
  -webkit-font-smoothing: antialiased;
}

.auth-shell {
  height: var(--page-h);
  max-height: var(--page-h);
  display: grid;
  grid-template-columns: minmax(240px, 0.9fr) minmax(300px, 1.1fr);
  overflow: hidden;
}

.auth-stage {
  position: relative;
  min-height: 0;
  height: 100%;
  overflow: hidden;
  background: #3d8fc4;
  display: grid;
  place-items: center;
  padding: clamp(1rem, 4vh, 2.5rem) clamp(1rem, 3vw, 2rem);
}

.auth-stage__logo {
  display: block;
  width: auto;
  height: auto;
  max-width: min(100%, 420px);
  max-height: min(100%, 78vh);
  object-fit: contain;
  object-position: center center;
  border-radius: 12px;
  box-shadow: 0 18px 40px rgba(12, 40, 70, 0.22);
}

.auth-panel {
  min-height: 0;
  height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  padding:
    clamp(0.6rem, 2.2vh, 1.6rem)
    clamp(1rem, 3.2vw, 2.4rem);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.97), rgba(242, 247, 251, 0.99)),
    var(--mist);
}

.auth-brand {
  margin-bottom: clamp(0.45rem, 1.4vh, 1rem);
  flex-shrink: 0;
}

.auth-brand__logo {
  display: none;
}

.auth-brand__app {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.35rem, 2.8vh, 2rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
  color: var(--ink);
}

.auth-brand__lead {
  margin: 0.35rem 0 0;
  color: rgba(22, 58, 92, 0.72);
  font-size: clamp(0.82rem, 1.7vh, 0.95rem);
  line-height: 1.35;
  max-width: 38ch;
}

.auth-ok {
  margin-bottom: 0.55rem;
  padding: 0.55rem 0.75rem;
  border-radius: 8px;
  background: #ecfdf3;
  color: #067647;
  border: 1px solid rgba(6, 118, 71, 0.2);
  font-size: 0.85rem;
}

.auth-ident {
  margin: 0 0 0.75rem;
  padding: 0.65rem 0.7rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.auth-ident legend {
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0 0.25rem;
}

.auth-ident__opt {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.5rem;
  align-items: start;
  margin-top: 0.45rem;
  font-size: 0.82rem;
  cursor: pointer;
}

.auth-ident__opt strong {
  display: block;
  font-size: 0.88rem;
}

.auth-ad {
  display: grid;
  gap: 0.35rem;
  margin-bottom: 0.75rem;
}

.auth-ident-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1rem;
  align-items: center;
  margin-top: 0.35rem;
}

.auth-alert {
  margin-bottom: 0.55rem;
  padding: 0.55rem 0.75rem;
  border-radius: 8px;
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid rgba(180, 35, 24, 0.18);
  font-size: 0.85rem;
  flex-shrink: 0;
}

.auth-form {
  display: grid;
  gap: clamp(0.4rem, 1.15vh, 0.75rem);
  max-width: 24rem;
  width: 100%;
  flex-shrink: 1;
  min-height: 0;
}

.auth-field {
  display: grid;
  gap: 0.22rem;
}

.auth-field label {
  font-size: clamp(0.78rem, 1.5vh, 0.88rem);
  font-weight: 600;
}

.auth-field input,
.auth-field select,
.auth-field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: clamp(0.45rem, 1.2vh, 0.7rem) 0.8rem;
  font: inherit;
  font-size: clamp(0.88rem, 1.6vh, 1rem);
  color: var(--ink);
  background: #fff;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.auth-field input:focus,
.auth-field textarea:focus {
  outline: none;
  border-color: rgba(61, 143, 196, 0.7);
  box-shadow: 0 0 0 3px rgba(61, 143, 196, 0.2);
}

.auth-field textarea {
  resize: vertical;
  min-height: 4.5rem;
}

.auth-hint {
  margin: 0;
  font-size: clamp(0.68rem, 1.3vh, 0.76rem);
  color: rgba(22, 58, 92, 0.55);
  line-height: 1.3;
}

.auth-remember {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.55rem;
  align-items: start;
  margin: 0.1rem 0 0;
  font-size: clamp(0.78rem, 1.5vh, 0.88rem);
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
}

.auth-remember input {
  width: 1rem;
  height: 1rem;
  margin-top: 0.15rem;
  accent-color: var(--brand-deep);
}

.auth-mode {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 0.22rem 0.55rem;
  border-radius: 999px;
  background: rgba(47, 157, 120, 0.12);
  color: var(--ink-soft);
  font-size: 0.72rem;
  font-weight: 600;
}

.auth-submit {
  appearance: none;
  border: 0;
  border-radius: 8px;
  padding: clamp(0.55rem, 1.35vh, 0.8rem) 1rem;
  font: inherit;
  font-size: clamp(0.88rem, 1.6vh, 1rem);
  font-weight: 600;
  color: #fff;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-deep) 100%);
  cursor: pointer;
  transition: transform 0.15s ease, filter 0.15s ease, opacity 0.15s ease;
}

.auth-submit:hover:not(:disabled) {
  filter: brightness(1.05);
  transform: translateY(-1px);
}

.auth-submit:active:not(:disabled) {
  transform: translateY(0);
}

.auth-submit:disabled {
  opacity: 0.65;
  cursor: wait;
}

.auth-submit--secondary {
  width: 100%;
  background: linear-gradient(135deg, var(--ink-soft) 0%, var(--ink) 100%);
}

.auth-alt {
  margin-top: 0.1rem;
}

.auth-link {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--brand-deep);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.auth-notice {
  margin: clamp(0.7rem, 1.8vh, 1.1rem) 0 0;
  max-width: 42rem;
  font-size: clamp(0.68rem, 1.25vh, 0.78rem);
  line-height: 1.4;
  color: rgba(22, 58, 92, 0.72);
}

.auth-foot {
  margin: clamp(0.45rem, 1.4vh, 0.8rem) 0 0;
  font-size: 0.72rem;
  color: rgba(22, 58, 92, 0.48);
  flex-shrink: 0;
}

.auth-remember[hidden],
.auth-credentials[hidden],
.auth-sso[hidden],
.auth-alt[hidden],
.auth-mode[hidden],
.auth-field[hidden],
.auth-alert[hidden],
.auth-ok[hidden],
.auth-ad[hidden],
.auth-ident[hidden],
.auth-ident__opt[hidden],
.auth-import[hidden],
.auth-onboard[hidden],
.auth-form[hidden] {
  display: none !important;
}

.auth-import,
.auth-onboard {
  display: grid;
  gap: 0.65rem;
  max-width: 26rem;
}

.auth-equipe {
  display: grid;
  gap: 0.35rem;
  font-size: 0.82rem;
}

.auth-membre {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.4rem 0.55rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

@media (max-height: 720px) {
  .auth-hint {
    display: none;
  }

  .auth-brand__lead {
    display: none;
  }
}

@media (max-height: 560px) {
  .auth-foot {
    display: none;
  }

  .auth-brand__app {
    font-size: 1.2rem;
  }
}

@media (max-width: 900px) {
  .auth-shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
  }

  .auth-stage {
    height: auto;
    padding: 0.65rem 0.85rem;
  }

  .auth-stage__logo {
    max-width: min(220px, 55vw);
    max-height: 22vh;
    border-radius: 10px;
  }

  .auth-panel {
    justify-content: flex-start;
    padding-top: clamp(0.55rem, 1.8vh, 1rem);
  }
}

@media (prefers-reduced-motion: reduce) {
  .auth-submit {
    transition: none;
  }
}

/* Écran de connexion : carte aérée, lisible, centrée dans le panneau. */

.auth-kicker {
  margin: 0 0 0.45rem;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--brand-deep);
}

.auth-card {
  width: min(100%, 32rem);
  margin: auto;
  background: #fff;
  border: 1px solid rgba(22, 58, 92, 0.12);
  border-radius: 18px;
  box-shadow: 0 18px 50px rgba(22, 58, 92, 0.08);
  padding: 2rem 2rem 1.5rem;
}

.auth-credentials,
.auth-actions {
  display: grid;
  gap: 1.15rem;
}

.auth-actions {
  margin-top: 0.35rem;
}

.auth-shell .auth-stage {
  background:
    radial-gradient(90% 70% at 15% 0%, rgba(255, 255, 255, 0.22), transparent 55%),
    linear-gradient(165deg, #4aa0d4 0%, #2a6fa0 48%, #163a5c 100%);
}

.auth-shell .auth-panel {
  justify-content: flex-start;
  align-items: stretch;
  padding: clamp(1.5rem, 5vh, 3rem) clamp(1.25rem, 4vw, 3.5rem);
  background: var(--mist);
}

.auth-shell .auth-brand {
  margin-bottom: 1.5rem;
}

.auth-shell .auth-brand__app {
  font-size: 2rem;
  line-height: 1.15;
}

.auth-shell .auth-brand__lead {
  margin-top: 0.55rem;
  max-width: none;
  font-size: 1rem;
  line-height: 1.5;
  color: rgba(22, 58, 92, 0.72);
}

.auth-shell .auth-form,
.auth-shell .auth-import,
.auth-shell .auth-onboard {
  gap: 1.15rem;
  max-width: none;
  width: 100%;
}

.auth-shell .auth-field {
  gap: 0.4rem;
}

.auth-shell .auth-field label {
  font-size: 0.92rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.auth-shell .auth-field input,
.auth-shell .auth-field select,
.auth-shell .auth-field textarea {
  border: 1px solid rgba(22, 58, 92, 0.2);
  border-radius: 10px;
  padding: 0.8rem 0.95rem;
  font-size: 1rem;
  line-height: 1.35;
}

.auth-shell .auth-field input::placeholder {
  color: rgba(22, 58, 92, 0.38);
}

.auth-shell .auth-hint {
  font-size: 0.82rem;
  line-height: 1.45;
  color: rgba(22, 58, 92, 0.62);
}

.auth-shell .auth-hint[hidden] {
  display: none !important;
}

.auth-shell [data-ldap-status] {
  margin: 0 0 1.35rem;
  padding: 0.7rem 0.85rem;
  border-radius: 10px;
  background: var(--mist);
  border: 1px solid var(--line);
  font-size: 0.9rem;
  line-height: 1.45;
  color: rgba(22, 58, 92, 0.78);
}

.auth-shell .auth-mode {
  margin: 0.1rem 0 0.15rem;
  padding: 0.32rem 0.7rem;
  font-size: 0.8rem;
}

.auth-shell .auth-remember {
  align-items: flex-start;
  gap: 0.7rem;
  margin: 0.15rem 0 0;
  font-size: 0.92rem;
  font-weight: 500;
  line-height: 1.45;
}

.auth-shell .auth-remember input {
  width: 1.1rem;
  height: 1.1rem;
  margin-top: 0.2rem;
}

.auth-shell .auth-submit {
  width: 100%;
  border-radius: 10px;
  padding: 0.85rem 1rem;
  font-size: 1rem;
}

.auth-shell .auth-actions .auth-link,
.auth-shell .auth-form > .auth-link {
  justify-self: center;
  font-size: 0.92rem;
  text-underline-offset: 3px;
}

.auth-shell .auth-notice {
  margin: 1.75rem 0 0;
  padding-top: 1.1rem;
  border-top: 1px solid var(--line);
  max-width: none;
  font-size: 0.8rem;
  line-height: 1.55;
  color: rgba(22, 58, 92, 0.62);
}

.auth-shell .auth-foot {
  display: block;
  margin-top: 0.85rem;
  font-size: 0.8rem;
  line-height: 1.45;
}

.auth-shell .auth-alert,
.auth-shell .auth-ok {
  margin-bottom: 1rem;
  padding: 0.75rem 0.9rem;
  font-size: 0.9rem;
  line-height: 1.4;
}

@media (max-height: 720px) {
  .auth-shell .auth-hint:not([hidden]),
  .auth-shell .auth-brand__lead {
    display: block;
  }
}

@media (max-height: 560px) {
  .auth-shell .auth-foot {
    display: block;
  }

  .auth-shell .auth-brand__app {
    font-size: 1.65rem;
  }
}

@media (max-width: 900px) {
  .auth-shell .auth-panel {
    padding: 1.25rem 1rem 1.75rem;
  }

  .auth-card {
    padding: 1.5rem 1.25rem 1.25rem;
    border-radius: 16px;
  }

  .auth-shell .auth-brand__app {
    font-size: 1.7rem;
  }
}
