:root {
  --ink: #262F37;
  --ink-deep: #1B2127;
  --ink-soft: #3A434B;
  --paper: #F4F4F1;
  --paper-pure: #FFFFFF;
  --signal: #FF6B00;
  --signal-deep: #E25F00;
  --signal-tint: rgba(255, 107, 0, .12);
  --body: #4B535A;
  --body-dim: #8A8F90;
  --line: #E3E1DB;
  --line-dk: #39424A;
  --cream-on-dk: #EDEEEC;
  --dim-on-dk: #BCC0C3;
  --font: "Nunito Sans", system-ui, -apple-system, sans-serif;
  --ease: cubic-bezier(.22, 1, .36, 1);
}

* { box-sizing: border-box; }

html,
body {
  margin: 0;
  height: 100%;
}

body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--paper-pure);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

.auth {
  display: grid;
  grid-template-columns: 1.08fr 1fr;
  min-height: 100vh;
}

/* ===== LEFT: brand band ===== */
.brandside {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: clamp(40px, 4.4vw, 64px);
  background: radial-gradient(120% 90% at 12% 0%, #2C353E 0%, var(--ink) 42%, var(--ink-deep) 100%);
  color: var(--cream-on-dk);
}

.brandside::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(237, 238, 236, .06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(237, 238, 236, .06) 1px, transparent 1px);
  background-size: 58px 58px;
  -webkit-mask-image: radial-gradient(130% 100% at 18% 12%, #000, transparent 82%);
  mask-image: radial-gradient(130% 100% at 18% 12%, #000, transparent 82%);
}

.brandside::after {
  content: "";
  position: absolute;
  width: 560px;
  height: 560px;
  right: -180px;
  bottom: -200px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 107, 0, .18) 0%, rgba(255, 107, 0, 0) 68%);
  pointer-events: none;
}

.bs-top,
.bs-mid,
.bs-bot { position: relative; z-index: 1; }

.bs-logo {
  height: 40px;
  width: auto;
  display: block;
}

.bs-mid { max-width: 440px; }

.bs-kick {
  display: inline-block;
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--signal);
  margin-bottom: 20px;
}

.bs-mid h2 {
  font-size: clamp(30px, 3.5vw, 44px);
  line-height: 1.03;
  letter-spacing: -.03em;
  color: #fff;
  margin: 0;
  font-weight: 900;
}

.bs-mid p {
  font-size: 18px;
  line-height: 1.55;
  color: var(--dim-on-dk);
  margin: 18px 0 0;
  font-weight: 500;
  max-width: 30ch;
}

.spine {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 30px;
  flex-wrap: wrap;
}

.spine span {
  font-size: 12.5px;
  font-weight: 800;
  letter-spacing: .02em;
  color: var(--cream-on-dk);
}

.spine i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--signal);
  display: inline-block;
}

.bs-bot {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.stores {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.store {
  width: 188px;
  box-sizing: border-box;
  justify-content: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, .05);
  border: 1px solid rgba(255, 255, 255, .2);
  border-radius: 12px;
  padding: 9px 15px;
  color: #fff;
  text-decoration: none;
  transition: background .25s, border-color .25s, transform .3s var(--ease);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

.store:hover {
  background: rgba(255, 255, 255, .1);
  border-color: rgba(255, 255, 255, .4);
  transform: translateY(-2px);
  color: #fff;
  text-decoration: none;
}

.store svg {
  width: 23px;
  height: 23px;
  display: block;
  flex: none;
}

.store .tx {
  display: flex;
  flex-direction: column;
  line-height: 1.05;
  text-align: left;
}

.store .tx small {
  font-size: 8.5px;
  font-weight: 600;
  letter-spacing: .07em;
  text-transform: uppercase;
  opacity: .85;
}

.store .tx b {
  font-size: 14px;
  font-weight: 700;
}

.more {
  font-size: 14px;
  color: var(--dim-on-dk);
  font-weight: 600;
  margin: 0;
}

.more a {
  color: #fff;
  text-decoration: none;
  font-weight: 800;
  border-bottom: 1px solid var(--signal);
}

.more a:hover { color: var(--signal); }

/* ===== RIGHT: form ===== */
.formside {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(40px, 5vw, 64px);
  background: var(--paper-pure);
}

.card {
  width: 100%;
  max-width: 382px;
  border: none;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
  display: block;
  padding: 0;
}

.field input.form-control,
.auth-modal input.form-control {
  height: auto;
  box-shadow: none;
}

.card .logo {
  height: 44px;
  width: auto;
  margin-bottom: 40px;
}

.card h1 {
  font-size: 33px;
  letter-spacing: -.025em;
  margin: 0 0 26px;
  font-weight: 900;
  color: var(--ink);
}

.step { animation: fade .45s var(--ease) both; }

@keyframes fade {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

.field { margin-bottom: 18px; }

.field label,
.field .control-label {
  display: block;
  font-size: 13px;
  font-weight: 800;
  color: var(--ink);
  margin-bottom: 7px;
}

.field .ip { position: relative; }

.field input,
.auth-modal input.form-control {
  width: 100%;
  font: inherit;
  font-size: 15.5px;
  padding: 14px 15px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #FAFAF8;
  color: var(--ink);
  transition: border-color .2s, box-shadow .2s, background .2s;
}

.field input::placeholder { color: #B4B9BB; }

.field input:focus,
.auth-modal input.form-control:focus {
  outline: none;
  border-color: var(--signal);
  background: #fff;
  box-shadow: 0 0 0 3px var(--signal-tint);
}

.field input.err,
.field input.error,
.auth-modal input.error {
  border-color: var(--signal);
}

.field label.error,
.auth-modal label.error,
.msg {
  display: block;
  font-size: 12.5px;
  color: var(--signal-deep);
  font-weight: 700;
  margin: 7px 1px 0;
}

.btn {
  width: 100%;
  font: inherit;
  font-weight: 800;
  font-size: 15.5px;
  color: #fff;
  background: var(--signal);
  border: none;
  border-radius: 11px;
  padding: 15px;
  cursor: pointer;
  transition: transform .3s var(--ease), background .25s, box-shadow .3s;
  margin-top: 4px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn:hover,
.btn:focus {
  background: var(--signal-deep);
  transform: translateY(-2px);
  box-shadow: 0 16px 30px -14px rgba(255, 107, 0, .55);
  color: #fff;
  text-decoration: none;
}

.btn:active { transform: translateY(1px) scale(.992); }

.btn.disabled,
.btn:disabled {
  opacity: .7;
  pointer-events: none;
}

.row-actions {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-top: 18px;
}

.row-actions .btn {
  width: auto;
  flex: none;
  padding: 14px 32px;
  margin: 0;
}

.link {
  background: none;
  border: none;
  font: inherit;
  font-weight: 800;
  color: var(--signal-deep);
  cursor: pointer;
  font-size: 15px;
  padding: 0;
  text-decoration: none;
}

.link:hover { text-decoration: underline; color: var(--signal-deep); }

.divide {
  height: 1px;
  background: var(--line);
  margin: 30px 0 20px;
}

.alt {
  font-size: 15px;
  color: var(--body);
  font-weight: 600;
  margin: 0;
}

.alt a {
  color: var(--signal-deep);
  font-weight: 800;
  text-decoration: none;
}

.alt a:hover { text-decoration: underline; }

.foot {
  margin-top: 34px;
  font-size: 12.5px;
  color: var(--body-dim);
  font-weight: 600;
}

.foot a {
  color: var(--signal-deep);
  text-decoration: none;
}

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

.peek {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  color: var(--body-dim);
  display: inline-flex;
  border-radius: 8px;
  transition: color .2s;
}

.peek:hover { color: var(--ink); }

.peek svg {
  width: 20px;
  height: 20px;
}

.field .ip input[type="password"],
.field .ip input.has-peek {
  padding-right: 46px;
}

.back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--body);
  font: inherit;
  font-weight: 800;
  font-size: 14px;
  padding: 0;
  margin-bottom: 18px;
  transition: color .2s;
  text-decoration: none;
}

.back:hover { color: var(--ink); text-decoration: none; }

.back svg {
  width: 16px;
  height: 16px;
}

.emailpill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--ink-soft);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 14px;
  margin-bottom: 22px;
  font-weight: 700;
}

.emailpill svg {
  width: 15px;
  height: 15px;
  color: var(--signal);
  flex: none;
}

.hidden { display: none !important; }

.msbtn {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 11px;
  font: inherit;
  font-weight: 800;
  font-size: 15px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 13px;
  cursor: pointer;
  transition: border-color .2s, box-shadow .2s, transform .3s var(--ease);
  text-decoration: none;
}

.msbtn:hover {
  border-color: #C9C7C0;
  box-shadow: 0 8px 22px -14px rgba(38, 47, 55, .4);
  transform: translateY(-1px);
  color: var(--ink);
  text-decoration: none;
}

.msbtn .mslogo,
.msbtn img {
  width: 19px;
  height: 19px;
  display: block;
  flex: none;
}

.orline {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 20px 0;
  color: var(--body-dim);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.orline::before,
.orline::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

.redirect {
  text-align: center;
  padding: 8px 0 4px;
  animation: fade .45s var(--ease) both;
}

.redirect .spin {
  width: 42px;
  height: 42px;
  margin: 6px auto 22px;
  border: 3px solid var(--line);
  border-top-color: var(--signal);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.redirect h2 {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -.01em;
  color: var(--ink);
  margin: 0 0 8px;
}

.redirect p {
  font-size: 15px;
  color: var(--body);
  margin: 0 0 4px;
  font-weight: 500;
}

.redirect .who {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 18px;
  font-size: 13.5px;
  color: var(--ink-soft);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 14px;
  font-weight: 700;
}

.redirect .cancel { margin-top: 22px; }

.auth-alert {
  border-radius: 11px;
  padding: 12px 14px;
  margin: 0 0 18px;
  font-size: 13.5px;
  font-weight: 700;
  line-height: 1.4;
  position: relative;
}

.auth-alert-danger {
  background: #FFF3EC;
  color: var(--signal-deep);
  border: 1px solid rgba(255, 107, 0, .28);
}

.auth-alert-success {
  background: #F3F7F2;
  color: #2F6B3A;
  border: 1px solid #D5E4D4;
}

.auth-alert .close {
  position: absolute;
  top: 8px;
  right: 10px;
  background: none;
  border: none;
  font-size: 20px;
  line-height: 1;
  color: inherit;
  opacity: .55;
  cursor: pointer;
}

.auth-alert .close:hover { opacity: 1; }

.auth-alert span { padding-right: 18px; display: block; }

.loadingBar {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(255, 255, 255, .62);
  display: none;
  align-items: center;
  justify-content: center;
}

.loadingBar.is-visible,
.loadingBar[style*="block"] {
  display: flex !important;
}

.loadingBarText {
  width: 42px;
  height: 42px;
  border: 3px solid var(--line);
  border-top-color: var(--signal);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

.auth-modal .modal-content {
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 24px 50px -24px rgba(38, 47, 55, .35);
  overflow: hidden;
}

.auth-modal .modal-header {
  border-bottom: 1px solid var(--line);
  padding: 20px 22px 16px;
}

.auth-modal .modal-title {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -.015em;
  color: var(--ink);
  margin: 0;
}

.auth-modal .modal-header .close {
  background: none;
  border: none;
  font-size: 26px;
  line-height: 1;
  color: var(--body-dim);
  opacity: 1;
}

.auth-modal .modal-body { padding: 20px 22px 24px; }

.auth-modal .control-label {
  width: auto;
  line-height: 1.4;
  margin-bottom: 10px;
}

.auth-modal .form-action { margin-top: 8px; }

.sso-copy {
  font-size: 15px;
  line-height: 1.55;
  color: var(--body);
  font-weight: 500;
  margin: 0 0 18px;
}

@media (min-width: 901px) {
  .formside .logo { display: none; }
}

@media (max-width: 900px) {
  .auth { grid-template-columns: 1fr; }
  .brandside { display: none; }
  .formside {
    padding: 56px 24px 40px;
    min-height: 100vh;
    align-items: flex-start;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}
