.tms-identity-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, .42);
  backdrop-filter: blur(4px);
  z-index: 9998;
}

.tms-identity-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: min(430px, 94vw);
  height: 100vh;
  background: #fff;
  color: #0f172a;
  z-index: 9999;
  box-shadow: -18px 0 55px rgba(15, 23, 42, .24);
  transform: translateX(105%);
  transition: transform .28s ease;
  padding: 28px;
  overflow-y: auto;
  box-sizing: border-box;
}

.tms-identity-drawer.is-open {
  transform: translateX(0);
}

.tms-identity-close {
  position: absolute;
  top: 14px;
  right: 16px;
  border: 0;
  background: #f1f5f9;
  border-radius: 999px;
  width: 34px;
  height: 34px;
  cursor: pointer;
  font-size: 22px;
}

.tms-identity-kicker {
  color: #64748b;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.tms-identity-head h2 {
  margin: 8px 0 8px;
  font-size: 28px;
}

.tms-identity-head p {
  color: #64748b;
  margin-bottom: 22px;
}

.tms-identity-login label {
  display: block;
  margin-bottom: 14px;
}

.tms-identity-login span {
  display: block;
  font-weight: 700;
  margin-bottom: 6px;
}

.tms-identity-login input {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid #cbd5e1;
  border-radius: 14px;
  padding: 12px 14px;
  font-size: 15px;
}

.tms-identity-primary {
  width: 100%;
  border: 0;
  border-radius: 16px;
  padding: 13px 16px;
  background: #0f172a;
  color: #fff;
  font-weight: 800;
  cursor: pointer;
  margin: 6px 0 22px;
}

.tms-identity-register {
  border-top: 1px solid #e2e8f0;
  padding-top: 18px;
}

.tms-identity-register h3 {
  margin: 0 0 12px;
}

.tms-identity-register a {
  display: block;
  text-decoration: none;
  color: #0f172a;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 12px 14px;
  margin-bottom: 10px;
  background: #f8fafc;
}

.tms-identity-register a:hover {
  background: #eef2ff;
  border-color: #c7d2fe;
}

.tms-identity-legal {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin-top: 22px;
  font-size: 13px;
  color: #64748b;
}

.tms-identity-legal a {
  color: #64748b;
  text-decoration: underline;
}

body.tms-identity-lock {
  overflow: hidden;
}

.tms-identity-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  margin: 8px 0 22px;
  border: 1px solid #e2e8f0;
  border-radius: 20px;
  background: linear-gradient(135deg, #f8fafc, #eef2ff);
}

.tms-identity-brandmark {
  width: 46px;
  height: 46px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: #0f172a;
  color: #fff;
  font-weight: 900;
  letter-spacing: .04em;
  box-shadow: 0 10px 24px rgba(15, 23, 42, .18);
}

.tms-identity-brandname {
  font-weight: 900;
  color: #0f172a;
}

.tms-identity-brandline {
  font-size: 13px;
  color: #64748b;
  margin-top: 2px;
}

.tms-identity-register-intro {
  margin: -4px 0 14px;
  color: #64748b;
  font-size: 13px;
  line-height: 1.45;
}

.tms-identity-entry {
  position: relative;
  display: block;
  text-decoration: none;
  color: #0f172a;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 13px 14px 13px 16px;
  margin-bottom: 10px;
  background: #f8fafc;
  transition: transform .16s ease, background .16s ease, border-color .16s ease, box-shadow .16s ease;
}

.tms-identity-entry strong {
  display: block;
  font-size: 14px;
  margin-bottom: 4px;
}

.tms-identity-entry span {
  display: block;
  color: #64748b;
  font-size: 12.5px;
  line-height: 1.35;
}

.tms-identity-entry:hover {
  transform: translateY(-1px);
  background: #fff;
  border-color: #c7d2fe;
  box-shadow: 0 12px 28px rgba(15, 23, 42, .08);
}

.tms-identity-entry--business::after,
.tms-identity-entry--trainer::after,
.tms-identity-entry--consumer::after {
  position: absolute;
  top: 12px;
  right: 12px;
  border-radius: 999px;
  padding: 3px 7px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .03em;
}

.tms-identity-entry--consumer::after {
  content: "B2C";
  background: #ecfdf5;
  color: #047857;
}

.tms-identity-entry--trainer::after {
  content: "PRO";
  background: #eff6ff;
  color: #1d4ed8;
}

.tms-identity-entry--business::after {
  content: "B2B";
  background: #fff7ed;
  color: #c2410c;
}

/* TMS Identity Portal Mode v1 */
.tms-identity-drawer.is-portal-mode {
  border-radius: 28px 0 0 28px;
  box-shadow: 0 30px 90px rgba(0,0,0,.48);
}

body.tms-identity-source-portal .tms-identity-overlay {
  backdrop-filter: blur(8px);
  background: rgba(2, 6, 23, .50);
}

body.tms-identity-source-portal .tms-identity-drawer.is-open {
  animation: tmsIdentityPortalSlideIn .32s ease both;
}

@keyframes tmsIdentityPortalSlideIn {
  from {
    transform: translateX(110%) scale(.96);
    opacity: .2;
  }

  to {
    transform: translateX(0) scale(1);
    opacity: 1;
  }
}

/* TMS Identity Portal Mode v2 - stronger visual distinction */
body.tms-identity-source-portal .tms-identity-drawer.is-portal-mode.is-open {
  right: 28px !important;
  top: 72px !important;
  bottom: 28px !important;
  height: auto !important;
  max-height: calc(100vh - 100px) !important;
  border-radius: 28px !important;
  transform: translateX(0) scale(1) !important;
  animation: tmsIdentityPortalFloatIn .34s ease both !important;
}

@keyframes tmsIdentityPortalFloatIn {
  from {
    transform: translateX(80px) translateY(18px) scale(.94);
    opacity: 0;
  }

  to {
    transform: translateX(0) translateY(0) scale(1);
    opacity: 1;
  }
}

/* TMS Identity Portal Mode v3 - visible above portal/admin UI */
body.tms-identity-source-portal .tms-identity-drawer.is-portal-mode.is-open {
  position: fixed !important;
  z-index: 20000 !important;
  right: 32px !important;
  top: 140px !important;
  bottom: 32px !important;
  height: auto !important;
  max-height: calc(100vh - 172px) !important;
  width: min(440px, calc(100vw - 64px)) !important;
  border-radius: 28px !important;
  transform: translateX(0) scale(1) !important;
}

body.tms-identity-source-portal .tms-identity-overlay {
  z-index: 19990 !important;
}

/* TMS Identity Portal Mode v4 - adjusted placement */
body.tms-identity-source-portal .tms-identity-drawer.is-portal-mode.is-open {
  top: 180px !important;
  bottom: 40px !important;
  max-height: calc(100vh - 220px) !important;
}

/* TMS Identity Register Focus v1 */
.tms-identity-register.is-focused {
  outline: 2px solid rgba(96, 165, 250, .9);
  outline-offset: 8px;
  border-radius: 18px;
}

/* TMS Identity Portal Register Focus v2 */
body.tms-identity-source-portal .tms-identity-drawer.is-register-focus .tms-identity-login {
  opacity: .35;
  transform: scale(.98);
  pointer-events: none;
}

body.tms-identity-source-portal .tms-identity-drawer.is-register-focus .tms-identity-register {
  margin-top: 18px;
  padding: 18px;
  border-radius: 22px;
  background: rgba(37, 99, 235, .08);
  outline: 2px solid rgba(96, 165, 250, .85);
  outline-offset: 4px;
}

/* TMS Identity Portal Register Focus v2 */
body.tms-identity-source-portal .tms-identity-drawer.is-register-focus .tms-identity-login {
  opacity: .35;
  transform: scale(.98);
  pointer-events: none;
}

body.tms-identity-source-portal .tms-identity-drawer.is-register-focus .tms-identity-register {
  margin-top: 18px;
  padding: 18px;
  border-radius: 22px;
  background: rgba(37, 99, 235, .08);
  outline: 2px solid rgba(96, 165, 250, .85);
  outline-offset: 4px;
}

/* TMS Identity Runtime UX v5 */
body.tms-identity-source-portal .tms-identity-overlay {
  background: rgba(2, 6, 23, .16) !important;
  backdrop-filter: blur(2px) !important;
}

body.tms-identity-source-portal .tms-identity-drawer.is-portal-mode.is-open {
  right: 18px !important;
  top: 110px !important;
  bottom: 18px !important;
  max-height: calc(100vh - 128px) !important;
  width: min(520px, calc(100vw - 36px)) !important;

  animation: tmsIdentityRuntimePanelIn .42s cubic-bezier(.2,.9,.2,1) both !important;
}

@keyframes tmsIdentityRuntimePanelIn {
  from {
    transform: translateX(120%) scale(.96);
    opacity: 0;
  }

  to {
    transform: translateX(0) scale(1);
    opacity: 1;
  }
}


/* TMS Identity Runtime Origin Animation v1 */
body.tms-identity-source-portal .tms-identity-drawer.is-portal-mode.is-open {
  transform-origin: var(--tms-identity-origin-x, 100vw) var(--tms-identity-origin-y, 50vh) !important;
  animation: tmsIdentityFromHotspot .48s cubic-bezier(.2,.95,.2,1) both !important;
}

@keyframes tmsIdentityFromHotspot {
  from {
    opacity: 0;
    transform: translateX(72px) translateY(-12px) scale(.18);
    filter: blur(6px);
  }

  70% {
    opacity: 1;
    filter: blur(0);
  }

  to {
    opacity: 1;
    transform: translateX(0) translateY(0) scale(1);
    filter: blur(0);
  }
}

/* TMS Identity Runtime Origin Animation v2 - visible hotspot emergence */
body.tms-identity-source-portal .tms-identity-drawer.is-portal-mode.is-open {
  animation: tmsIdentityFromHotspotV2 .62s cubic-bezier(.16,1,.3,1) both !important;
}

@keyframes tmsIdentityFromHotspotV2 {
  from {
    opacity: 0;
    transform:
      translate(
        calc(var(--tms-identity-origin-x, 100vw) - 100vw + 80px),
        calc(var(--tms-identity-origin-y, 50vh) - 50vh)
      )
      scale(.12);
    filter: blur(8px);
  }

  55% {
    opacity: 1;
    filter: blur(1px);
  }

  to {
    opacity: 1;
    transform: translate(0, 0) scale(1);
    filter: blur(0);
  }
}

/* TMS Identity Runtime Origin Animation v3 - strong visible origin test */
body.tms-identity-source-portal .tms-identity-drawer.is-portal-mode.is-open {
  animation: tmsIdentityFromHotspotV3 .9s cubic-bezier(.16,1,.3,1) both !important;
}

@keyframes tmsIdentityFromHotspotV3 {
  0% {
    opacity: 0;
    transform:
      translate3d(
        calc(var(--tms-identity-origin-x, 100vw) - 100vw + 520px),
        calc(var(--tms-identity-origin-y, 50vh) - 50vh),
        0
      )
      scale(.08);
    filter: blur(10px);
  }

  45% {
    opacity: 1;
    filter: blur(2px);
  }

  100% {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1);
    filter: blur(0);
  }
}

/* TMS Identity Runtime Hotspot Position v1 */
body.tms-identity-source-portal .tms-identity-drawer.is-portal-mode.is-open {
  left: var(--tms-identity-panel-left, auto) !important;
  right: auto !important;
  top: var(--tms-identity-panel-top, 110px) !important;
  bottom: auto !important;
  height: auto !important;
  max-height: calc(100vh - 48px) !important;
}

/* TMS Identity Runtime JS Motion Control v1 */
body.tms-identity-source-portal .tms-identity-drawer.is-portal-mode.is-open {
  animation: none !important;
  right: auto !important;
  bottom: auto !important;
}

/* TMS Identity Portal Stabilize after motion experiment */
body.tms-identity-source-portal .tms-identity-drawer.is-portal-mode.is-open {
  position: fixed !important;
  right: 18px !important;
  left: auto !important;
  top: 110px !important;
  bottom: 18px !important;
  width: min(520px, calc(100vw - 36px)) !important;
  height: auto !important;
  max-height: calc(100vh - 128px) !important;
  transform: none !important;
  animation: tmsIdentityRuntimePanelIn .42s cubic-bezier(.2,.9,.2,1) both !important;
  filter: none !important;
}
