/* Partner triangle auth — login / logout */

.ms-auth {
  --teal-deep: #067a8a;
  --teal: #0d9aad;
  --teal-bright: #14b8c9;
  --teal-soft: #2ec4d4;
  --teal-mist: #a8e8f0;
  --gold: #d4b06a;
  --gold-soft: rgba(212, 176, 106, 0.55);
  --ink: #2a3340;
  --muted: #6b7585;
  --panel: #f7f8fa;
  --white: #ffffff;
  --sans: "Montserrat", "Segoe UI", system-ui, sans-serif;
  --display: "Cormorant Garamond", Georgia, "Times New Roman", serif;
  margin: 0;
  min-height: 100vh;
  min-height: 100svh;
  font-family: var(--sans);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  background:
    radial-gradient(ellipse 90% 70% at 85% 15%, rgba(168, 232, 240, 0.45) 0%, transparent 55%),
    radial-gradient(ellipse 70% 60% at 10% 90%, rgba(6, 90, 100, 0.35) 0%, transparent 50%),
    linear-gradient(145deg, #0fb4c4 0%, #0a9aab 42%, #07808f 100%);
  position: relative;
}

.ms-auth *,
.ms-auth *::before,
.ms-auth *::after {
  box-sizing: border-box;
}

/* —— Pattern stage —— */
.ms-auth-stage {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}

.ms-auth-shape {
  position: absolute;
  border-radius: 2.5rem;
  border: 1.5px solid var(--gold-soft);
  background: linear-gradient(
    155deg,
    rgba(255, 255, 255, 0.1) 0%,
    rgba(255, 255, 255, 0.02) 55%,
    rgba(0, 0, 0, 0.04) 100%
  );
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.22),
    0 20px 50px rgba(4, 60, 70, 0.12);
  transform-origin: center;
  animation: ms-auth-drift 18s ease-in-out infinite;
}

.ms-auth-shape--a {
  width: min(42vw, 28rem);
  height: min(58vh, 34rem);
  left: -6%;
  top: 8%;
  transform: rotate(-18deg);
  animation-delay: 0s;
}

.ms-auth-shape--b {
  width: min(36vw, 24rem);
  height: min(48vh, 28rem);
  left: 4%;
  top: 22%;
  transform: rotate(-12deg);
  opacity: 0.85;
  animation-delay: -4s;
  animation-duration: 22s;
}

.ms-auth-shape--c {
  width: min(30vw, 18rem);
  height: min(40vh, 22rem);
  right: -4%;
  bottom: 6%;
  transform: rotate(16deg);
  opacity: 0.55;
  animation-delay: -8s;
  animation-duration: 20s;
}

.ms-auth-shape--mesh {
  background-image:
    linear-gradient(
      155deg,
      rgba(255, 255, 255, 0.12) 0%,
      rgba(255, 255, 255, 0.03) 55%,
      rgba(0, 0, 0, 0.05) 100%
    ),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='56' viewBox='0 0 48 56'%3E%3Cg fill='none' stroke='%23ffffff' stroke-opacity='0.18' stroke-width='0.7'%3E%3Cpath d='M24 2 L46 14 L46 38 L24 50 L2 38 L2 14 Z'/%3E%3C/g%3E%3C/svg%3E");
  background-size: auto, 36px 42px;
}

.ms-auth-glow {
  position: absolute;
  width: 40vmin;
  height: 40vmin;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.22) 0%, transparent 68%);
  filter: blur(8px);
  animation: ms-auth-pulse 10s ease-in-out infinite;
}

.ms-auth-glow--1 {
  top: -8%;
  right: 12%;
}

.ms-auth-glow--2 {
  bottom: -10%;
  left: 18%;
  animation-delay: -5s;
  opacity: 0.7;
}

@keyframes ms-auth-drift {
  0%,
  100% {
    translate: 0 0;
  }
  50% {
    translate: 0 -12px;
  }
}

@keyframes ms-auth-pulse {
  0%,
  100% {
    opacity: 0.55;
    scale: 1;
  }
  50% {
    opacity: 0.9;
    scale: 1.06;
  }
}

@keyframes ms-auth-rise {
  from {
    opacity: 0;
    transform: translateY(22px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes ms-auth-brand-in {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* —— Shell —— */
.ms-auth-shell {
  position: relative;
  z-index: 2;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  padding: 1.25rem clamp(1rem, 3vw, 2rem) 1.5rem;
}

.ms-auth-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  animation: ms-auth-brand-in 0.7s ease both;
}

.ms-auth-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: var(--white);
  min-width: 0;
}

.ms-auth-brand-mark {
  display: block;
  height: 2.75rem;
  width: auto;
  object-fit: contain;
  filter:
    brightness(0)
    invert(1)
    drop-shadow(0 2px 6px rgba(4, 50, 60, 0.25));
}

.ms-auth-brand-text {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}

.ms-auth-brand-text strong {
  font-family: var(--display);
  font-size: clamp(1.35rem, 2.4vw, 1.7rem);
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1.05;
  color: #fff;
  text-shadow: 0 1px 10px rgba(4, 50, 60, 0.28);
}

.ms-auth-brand-text span {
  font-size: 0.62rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.82);
}

.ms-auth-nav {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.45rem 0.85rem;
}

.ms-auth-nav a {
  color: rgba(255, 255, 255, 0.88);
  text-decoration: none;
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  transition: color 0.2s ease;
}

.ms-auth-nav a:hover {
  color: #fff;
}

.ms-auth-nav a[aria-current="page"] {
  color: #fff;
  font-weight: 700;
}

.ms-auth-nav-sep {
  color: rgba(255, 255, 255, 0.35);
  font-size: 0.65rem;
  user-select: none;
}

/* —— Main composition —— */
.ms-auth-main {
  flex: 1;
  display: grid;
  place-items: center;
  padding: 1.25rem 0 1rem;
}

.ms-auth-compose {
  width: min(100%, 38rem);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.15rem;
  animation: ms-auth-rise 0.85s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.ms-auth-tagline {
  margin: 0;
  text-align: center;
  font-family: var(--display);
  font-size: clamp(1.45rem, 3vw, 1.95rem);
  font-weight: 500;
  font-style: italic;
  color: rgba(255, 255, 255, 0.95);
  letter-spacing: 0.02em;
  text-shadow: 0 2px 18px rgba(4, 50, 60, 0.28);
}

/* —— Triangle panel —— */
.ms-auth-triangle {
  --tri-w: min(100%, 36.5rem);
  position: relative;
  width: var(--tri-w);
  aspect-ratio: 460 / 400;
  filter: drop-shadow(0 30px 42px rgba(4, 40, 50, 0.3))
    drop-shadow(0 10px 16px rgba(4, 40, 50, 0.16));
}

.ms-auth-triangle-shape {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
}

.ms-auth-triangle-body {
  position: absolute;
  z-index: 1;
  left: 50%;
  top: 12.5%;
  transform: translateX(-50%);
  /* Use more of the upper triangle width for email/password */
  width: min(54%, 18.5rem);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.65rem;
  text-align: center;
}

.ms-auth-triangle-body h1 {
  margin: 0;
  font-family: var(--sans);
  font-size: clamp(1.25rem, 2.3vw, 1.5rem);
  font-weight: 600;
  color: var(--ink);
  letter-spacing: 0.01em;
  line-height: 1.15;
}

.ms-auth-lede {
  margin: -0.25rem 0 0.1rem;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0.01em;
}

/* Errors sit above the triangle so fields never shift into the tip. */
.ms-auth-flash {
  width: min(100%, 28rem);
  margin: 0 auto 0.85rem;
  display: grid;
  gap: 0.4rem;
}

.ms-auth-alert {
  margin: 0;
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  font-size: 0.78rem;
  line-height: 1.35;
  text-align: center;
  background: rgba(254, 242, 242, 0.95);
  border: 1px solid rgba(185, 28, 28, 0.16);
  color: #991b1b;
  box-shadow: 0 8px 18px rgba(4, 40, 50, 0.12);
}

.ms-auth-alert-success,
.ms-auth-alert-info {
  background: rgba(236, 253, 245, 0.95);
  border-color: rgba(13, 148, 136, 0.2);
  color: #0f766e;
}

.ms-auth-form {
  display: grid;
  gap: 0.6rem;
  width: 100%;
  justify-items: stretch;
}

.ms-auth-form .ms-auth-submit {
  /* Slightly narrower than fields so the lower taper still clears */
  width: 82%;
  margin-left: auto;
  margin-right: auto;
}

.ms-auth-field {
  position: relative;
  display: block;
}

.ms-auth-field input {
  width: 100%;
  height: 2.75rem;
  padding: 0 2.45rem 0 2.45rem;
  border: 1px solid rgba(42, 51, 64, 0.1);
  border-radius: 10px;
  background: var(--white);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 0.88rem;
  font-weight: 500;
  outline: none;
  box-shadow: 0 2px 8px rgba(42, 51, 64, 0.05);
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.ms-auth-field input::placeholder {
  color: rgba(107, 117, 133, 0.85);
  font-weight: 400;
}

.ms-auth-field input:focus {
  border-color: rgba(13, 154, 173, 0.65);
  box-shadow: 0 0 0 3px rgba(13, 154, 173, 0.16);
}

.ms-auth-ico,
.ms-auth-eye {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--teal);
}

.ms-auth-ico {
  left: 0.75rem;
  width: 1.1rem;
  height: 1.1rem;
  pointer-events: none;
}

.ms-auth-ico svg,
.ms-auth-eye svg {
  width: 100%;
  height: 100%;
}

.ms-auth-eye {
  right: 0.4rem;
  width: 1.9rem;
  height: 1.9rem;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  color: rgba(107, 117, 133, 0.85);
}

.ms-auth-eye:hover {
  color: var(--teal);
}

.ms-auth-submit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 2.75rem;
  margin-top: 0.05rem;
  border: 0;
  border-radius: 10px;
  background: #067a8a;
  background: linear-gradient(
    180deg,
    var(--teal-soft, #0d9aad) 0%,
    var(--teal, #067a8a) 55%,
    var(--teal-deep, #043c46) 100%
  );
  color: #fff;
  font-family: var(--sans, Montserrat, "Segoe UI", sans-serif);
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(7, 100, 112, 0.28);
  transition: transform 0.15s ease, filter 0.15s ease, box-shadow 0.15s ease;
}

.ms-auth-submit:hover {
  filter: brightness(1.05);
  box-shadow: 0 10px 22px rgba(7, 100, 112, 0.34);
}

.ms-auth-submit:active {
  transform: translateY(1px);
}

.ms-auth-submit--ghost {
  background: transparent;
  color: var(--teal);
  border: 1.5px solid rgba(13, 154, 173, 0.35);
  box-shadow: none;
}

.ms-auth-submit--ghost:hover {
  background: rgba(13, 154, 173, 0.06);
  filter: none;
  box-shadow: none;
}

.ms-auth-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-top: 0.05rem;
}

.ms-auth-check {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 500;
  cursor: pointer;
  user-select: none;
}

.ms-auth-check input {
  width: 0.85rem;
  height: 0.85rem;
  accent-color: var(--teal);
}

.ms-auth-divider {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin: 0.1rem auto 0;
  width: 78%;
  color: rgba(107, 117, 133, 0.75);
  font-size: 0.74rem;
  font-weight: 500;
}

.ms-auth-divider::before,
.ms-auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: rgba(42, 51, 64, 0.12);
}

.ms-auth-links {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  margin: 0 auto;
  width: 85%;
}

.ms-auth-links a {
  color: var(--teal);
  text-decoration: none;
  font-size: 0.8rem;
  font-weight: 600;
  transition: color 0.18s ease;
}

.ms-auth-links a:hover {
  color: var(--teal-deep);
  text-decoration: underline;
}

.ms-auth-register {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.88);
  text-align: center;
  text-shadow: 0 1px 8px rgba(4, 50, 60, 0.25);
}

.ms-auth-register a {
  font-size: inherit;
  color: #fff;
  font-weight: 700;
  text-decoration: none;
}

.ms-auth-register a:hover {
  text-decoration: underline;
}

.ms-auth-triangle-body--logout {
  top: 15.5%;
  width: min(52%, 17.5rem);
  gap: 0.7rem;
}

/* —— Registration (same stage, wider white panel) —— */
.ms-auth--register {
  overflow-y: auto;
}

.ms-auth--register .ms-auth-stage {
  position: fixed;
}

.ms-auth--register .ms-auth-main {
  place-items: start center;
  padding: 0.5rem 0 1.25rem;
}

.ms-auth-compose--register {
  width: min(100%, 46rem);
  gap: 1rem;
}

.ms-auth-register-panel {
  width: 100%;
  padding: 1.45rem 1.55rem 1.4rem;
  border-radius: 1.25rem;
  background: linear-gradient(180deg, #ffffff 0%, #f4f6f8 100%);
  box-shadow:
    0 30px 42px rgba(4, 40, 50, 0.28),
    0 10px 16px rgba(4, 40, 50, 0.14);
  color: var(--ink);
  text-align: left;
}

.ms-auth-register-panel .ms-auth-form .ms-auth-submit {
  width: 100%;
}

.ms-auth-register-intro {
  margin: 0 0 1rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid rgba(42, 51, 64, 0.08);
  text-align: center;
}

.ms-auth-register-intro h1 {
  margin: 0 0 0.3rem;
  font-family: var(--sans);
  font-size: clamp(1.25rem, 2.3vw, 1.5rem);
  font-weight: 600;
  color: var(--ink);
  letter-spacing: 0.01em;
  line-height: 1.15;
}

.ms-auth-register-intro p {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 500;
  line-height: 1.45;
}

.ms-auth-register-success {
  padding: 0.35rem 0 0.15rem;
  text-align: center;
}

.ms-auth-register-success h2 {
  margin: 0 0 0.55rem;
  font-family: var(--sans);
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--ink);
}

.ms-auth-register-success p {
  margin: 0 0 1.1rem;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

.ms-auth-register-success .ms-auth-submit {
  width: auto;
  min-width: 14rem;
  margin: 0 auto;
  padding: 0 1.35rem;
}

.ms-auth-register-panel .ms-auth-alert {
  margin: 0 0 1rem;
}

/* Logout-specific body copy inside triangle */
.ms-auth-logout-copy {
  margin: 0.15rem 0 0.35rem;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--muted);
  line-height: 1.45;
}

.ms-auth-logout-icon {
  width: 2.6rem;
  height: 2.6rem;
  margin: 0 auto 0.15rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(13, 154, 173, 0.1);
  color: var(--teal);
}

.ms-auth-logout-icon svg {
  width: 1.3rem;
  height: 1.3rem;
}

/* —— Footer —— */
.ms-auth-foot {
  margin-top: auto;
  padding-top: 0.85rem;
  display: grid;
  gap: 0.65rem;
  justify-items: center;
  text-align: center;
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  animation: ms-auth-brand-in 0.8s ease 0.15s both;
}

.ms-auth-payments {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.55rem 0.85rem;
}

.ms-auth-payments img {
  display: block;
  height: 18px;
  width: auto;
  object-fit: contain;
  flex-shrink: 0;
  /* Soft chip so blue Amex / Visa stay readable on teal auth footer */
  background: rgba(255, 255, 255, 0.96);
  padding: 0.2rem 0.38rem;
  border-radius: 4px;
}

.ms-auth-payments img[alt="Wallet"] { height: 20px; }
.ms-auth-payments img[alt="Mastercard"] { height: 22px; }
.ms-auth-payments img[alt="American Express"] { height: 18px; }

.ms-auth-foot-legal {
  margin: 0;
}

.ms-auth-foot a {
  color: rgba(255, 255, 255, 0.9);
  text-decoration: none;
  font-weight: 600;
}

.ms-auth-foot a:hover {
  text-decoration: underline;
}

.ms-auth-foot-sep {
  margin: 0 0.45rem;
  opacity: 0.45;
}

.ms-auth-payments .ms-auth-foot-sep {
  margin: 0;
  color: rgba(255, 255, 255, 0.45);
  font-size: 0.7rem;
  line-height: 1;
}

@media (max-width: 720px) {
  .ms-auth-shell {
    padding: 1rem 0.85rem 1.15rem;
  }

  .ms-auth-top {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  .ms-auth-nav {
    justify-content: flex-start;
  }

  .ms-auth-nav a {
    font-size: 0.6rem;
    letter-spacing: 0.1em;
  }

  .ms-auth-brand-mark {
    height: 2.35rem;
  }

  .ms-auth-triangle {
    --tri-w: min(100%, 28rem);
  }

  .ms-auth-triangle-body {
    width: min(56%, 16rem);
    top: 12%;
    gap: 0.55rem;
  }

  .ms-auth-triangle-body--logout {
    width: min(54%, 15rem);
  }

  .ms-auth-field input {
    height: 2.55rem;
    font-size: 0.82rem;
  }

  .ms-auth-submit {
    height: 2.55rem;
  }

  .ms-auth-shape--c {
    display: none;
  }

  .ms-auth-register-panel {
    padding: 1.2rem 1.05rem 1.15rem;
  }
}

@media (max-width: 400px) {
  .ms-auth-triangle-body {
    width: 76%;
  }

  .ms-auth-row {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ms-auth-shape,
  .ms-auth-glow,
  .ms-auth-compose,
  .ms-auth-top,
  .ms-auth-foot {
    animation: none !important;
  }
}
