/**
 * Tenant Shell R4 — custom login presentation (shell-owned /login).
 * Visual parity with certified dream-login-modal-presentation.css (R2.x).
 * Served only when SELF_SIGNUP_CUSTOM; ORIGINAL_DREAM never loads this file.
 */
/**
 * Dream login form (.ts-login-root /login) — layout + R2.1/R2.2 polish.
 * Capability-gated Create new ID: html[data-dream-auth-create-id="1"]
 * No modal Create ID flash.
 */

/* --- Page / card --- */
.ts-login-root .main-Box-login {
  background: linear-gradient(180deg, #3a3a3a 0%, #1a1a1a 55%, #0d0d0d 100%) !important;
}

.ts-login-root .centered-container {
  width: min(90vw, 380px) !important;
  max-width: 380px !important;
  margin: 0 auto !important;
  padding: 0 12px;
  box-sizing: border-box;
}

.ts-login-root .mt-4 {
  margin-top: 32px !important;
}

/* --- Close --- */
.ts-login-root .crossIcon {
  top: 16px !important;
  right: 16px !important;
  min-width: 36px;
  min-height: 36px;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  line-height: 1 !important;
}
.ts-login-root .crossIcon:focus-visible {
  outline: 2px solid #ffcc2f;
  outline-offset: 2px;
}

/* --- Logo --- */
.ts-login-root .loginlogo {
  margin-bottom: 4px !important;
}
.ts-login-root .loginlogo img {
  height: 72px !important;
  max-height: 72px !important;
  width: auto !important;
  object-fit: contain;
}

/* --- Field groups (reserved error slot — no jump) --- */
.ts-login-root form > .mb-4 {
  margin-bottom: 0 !important;
  padding-bottom: 22px;
  position: relative;
}

.ts-login-root form > .mb-4:first-of-type {
  margin-top: 0;
}

.ts-login-root form > .mb-4 + .mb-4 {
  margin-top: 14px !important;
}

.ts-login-root .error-message {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  min-height: 18px;
  margin: 0 !important;
  padding: 4px 0 0 !important;
  font-size: 12px !important;
  line-height: 1.25 !important;
  opacity: 1;
  overflow: hidden;
  color: var(--login-error-msg, #fff) !important;
}

.ts-login-root .dream-login-auth-error {
  min-height: 18px;
  margin: 0 0 12px;
  padding: 0;
  text-align: center;
  font-size: 13px;
  line-height: 1.3;
  color: var(--login-error-msg, #fff);
}

/* --- Inputs --- */
.ts-login-root .phoneNumberDiv {
  height: 50px !important;
  min-height: 50px;
  border-radius: 7px !important;
  border: 1px solid rgba(255, 255, 255, 0.22) !important;
  background: var(--login-input-bg, #fff) !important;
  overflow: hidden;
}

.ts-login-root .form-control.phoneNumberInput {
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
  height: 100% !important;
  min-height: 48px;
  padding: 0 44px 0 14px !important;
  font-size: 16px !important;
  border: 0 !important;
  border-radius: 7px !important;
  background: transparent !important;
}

.ts-login-root .form-control.phoneNumberInput:focus {
  outline: none;
  box-shadow: none !important;
}

.ts-login-root .phoneNumberDiv:focus-within {
  border-color: #ffcc2f !important;
  box-shadow: 0 0 0 2px rgba(255, 204, 47, 0.25);
}

.ts-login-root .showPasswordbtn {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 44px !important;
  min-width: 44px;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  padding: 0 !important;
  margin: 0 !important;
  background: transparent !important;
  border: none !important;
}

.ts-login-root .showPasswordbtn .inputicon {
  font-size: 16px;
  line-height: 1;
  pointer-events: none;
}

.ts-login-root form > .mb-4:first-of-type .phoneNumberDiv {
  position: relative;
}

.ts-login-root form > .mb-4:nth-of-type(2) .phoneNumberDiv {
  position: relative;
}

/* --- 70/30 action row --- */
.ts-login-root .dream-login-action-row {
  display: grid !important;
  grid-template-columns: minmax(0, 7fr) minmax(0, 3fr);
  gap: 8px;
  width: 100%;
  align-items: stretch;
  margin-top: 18px !important;
}

.ts-login-root .dream-login-action-row > button.loginBtn {
  width: 100% !important;
  max-width: none !important;
  margin: 0 !important;
  display: flex !important;
  align-items: center;
  justify-content: center;
  min-height: 50px;
  height: 100%;
  box-sizing: border-box;
  line-height: 1.15 !important;
  white-space: normal;
  border-radius: 7px !important;
  font-size: 16px !important;
  font-weight: 700 !important;
  touch-action: manipulation;
}

/* R2.2 — black text on yellow Login */
.ts-login-root .dream-login-action-row > button.loginBtn:not(.disablebtn) {
  color: #000 !important;
}

.ts-login-root .dream-login-action-row > button.loginBtn:not(.disablebtn):hover,
.ts-login-root .dream-login-action-row > button.loginBtn:not(.disablebtn):focus-visible {
  filter: brightness(1.05);
}

.ts-login-root .dream-login-action-row > button.loginBtn:focus-visible {
  outline: 2px solid #000;
  outline-offset: 2px;
}

/* Demo: two-line label — matched visual width via spans + letter-spacing */
.ts-login-root .dream-login-action-row > button.loginBtn.disablebtn {
  font-size: 0 !important;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 6px 3px !important;
  line-height: 1.15 !important;
  color: #000 !important;
  overflow: hidden;
}

.ts-login-root .dream-login-action-row > button.loginBtn.disablebtn .demo-login-line,
.ts-login-root .dream-login-action-row > button.loginBtn.disablebtn:not(:has(.demo-login-line))::before,
.ts-login-root .dream-login-action-row > button.loginBtn.disablebtn:not(:has(.demo-login-line))::after {
  display: block;
  width: 100%;
  box-sizing: border-box;
  margin: 0 auto;
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.15;
  color: #000 !important;
  white-space: nowrap;
  letter-spacing: normal;
  text-indent: 0;
}

/* Expand "Demo ID" glyph width to match "Login with" (~0.14em per gap at 11px) */
.ts-login-root .dream-login-action-row > button.loginBtn.disablebtn .demo-login-line.demo-login-id,
.ts-login-root .dream-login-action-row > button.loginBtn.disablebtn:not(:has(.demo-login-line))::after {
  letter-spacing: 0.14em;
  margin-right: -0.14em;
}

.ts-login-root .dream-login-action-row > button.loginBtn.disablebtn:not(:has(.demo-login-line))::before {
  content: "Login with";
}

.ts-login-root .dream-login-action-row > button.loginBtn.disablebtn:not(:has(.demo-login-line))::after {
  content: "Demo ID";
}

@media (max-width: 360px) {
  .ts-login-root .dream-login-action-row > button.loginBtn.disablebtn .demo-login-line,
  .ts-login-root .dream-login-action-row > button.loginBtn.disablebtn:not(:has(.demo-login-line))::before,
  .ts-login-root .dream-login-action-row > button.loginBtn.disablebtn:not(:has(.demo-login-line))::after {
    font-size: 10px;
  }
}

/* Stack forgot + create below action row (never inside grid) */
.ts-login-root form > button.dream-login-forgot,
.ts-login-root form > a.dream-login-create-id {
  clear: both;
}

.ts-login-root a.dream-login-create-id {
  display: block;
  width: 100% !important;
  max-width: 100% !important;
  float: none !important;
}

/* --- Forgotten Password --- */
.ts-login-root a.dream-login-forgot,
.ts-login-root button.dream-login-forgot {
  display: block;
  width: 100%;
  margin: 16px 0 0;
  padding: 0;
  border: 0;
  background: transparent;
  text-align: center;
  font-size: 14px !important;
  font-weight: 500 !important;
  font-family: Tahoma, Helvetica, sans-serif;
  color: var(--login-forget-pass-color, rgba(255, 255, 255, 0.88)) !important;
  text-decoration: underline !important;
  text-underline-offset: 2px;
  cursor: pointer;
  pointer-events: auto;
  opacity: 0.95;
}

.ts-login-root a.dream-login-forgot:focus-visible,
.ts-login-root button.dream-login-forgot:focus-visible {
  outline: none;
}

/* --- Create new ID — R2.2 filled yellow, black text, no flash --- */
.ts-login-root a.dream-login-create-id {
  display: none;
  width: 100%;
  margin-top: 20px;
  box-sizing: border-box;
  text-align: center;
  text-decoration: none !important;
  font-weight: 700;
  font-size: 16px;
  line-height: 50px;
  min-height: 50px;
  border-radius: 7px;
  border: 0 !important;
  background: var(
    --login-page-btn-bg,
    linear-gradient(180deg, #ffcc2f 8%, #ffb80c 100%)
  ) !important;
  color: #000 !important;
  box-shadow: none;
  animation: none !important;
}

.ts-login-root a.dream-login-create-id {
  display: block;
}

.ts-login-root a.dream-login-create-id:hover {
  filter: brightness(1.05);
  color: #000 !important;
}

.ts-login-root a.dream-login-create-id:focus-visible {
  outline: 2px solid #000;
  outline-offset: 2px;
}

@media (max-width: 360px) {
  .ts-login-root .centered-container {
    width: min(92vw, 360px) !important;
  }
}

.ts-login-root { width: 100%; }
.ts-login-root .main-Box-login {
  min-height: auto !important;
  padding: 0 !important;
  background: transparent !important;
}
.ts-login-root .crossIcon { display: none !important; } /* shell owns close */
.ts-login-root .loginlogo { display: none !important; } /* shell owns logo */
.ts-login-busy { opacity: 0.7; pointer-events: none; }

/* Shell-owned button chrome (Dream theme vars may be absent on auth shell) */
.ts-login-root .dream-login-action-row > button.loginBtn:not(.disablebtn) {
  background: linear-gradient(180deg, #ffcc2f 8%, #ffb80c 100%) !important;
  border: 0 !important;
}
.ts-login-root .dream-login-action-row > button.loginBtn.disablebtn {
  background: linear-gradient(180deg, #ffcc2f 8%, #ffb80c 100%) !important;
  border: 0 !important;
}
.ts-login-root .user-icon-fallback,
.ts-login-root .showPasswordbtn .ts-eye {
  display: inline-flex;
  width: 18px;
  height: 18px;
  color: #333;
}
.ts-login-root .phoneNumberDiv { position: relative; }
