:root {
  --auth-primary: #2563eb;
  --auth-secondary: #0ea5e9;
  --auth-orange: #ff8a00;
  --auth-white: #ffffff;
  --auth-text: #111827;
  --auth-muted: #64748b;
  --auth-border: #e2e8f0;
  --auth-font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  width: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  font-family: var(--auth-font);
  color: var(--auth-white);
  background: #020817;
}

button,
input {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

.login-page {
  position: relative;
  min-height: 100svh;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-areas: "brand auth";
  overflow: hidden;
  background:
    linear-gradient(90deg, rgba(1, 6, 20, 0.08), rgba(1, 4, 15, 0.42)),
    url("/assets/auth/mspblast-earth-network.png") center / cover no-repeat,
    radial-gradient(circle at center, #0f172a 0%, #020617 60%, #01040f 100%);
}

.login-page::after {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(90deg, transparent 0 44%, rgba(2, 8, 23, 0.3) 58%, rgba(2, 8, 23, 0.5) 100%);
  content: "";
}

.brand-panel,
.auth-panel,
.login-footer {
  position: relative;
  z-index: 1;
}

.brand-panel {
  grid-area: brand;
  min-width: 0;
  padding: 64px 48px 160px 88px;
}

.login-brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--auth-white);
  font-size: 34px;
  font-weight: 700;
  text-decoration: none;
}

.login-brand b {
  color: var(--auth-orange);
}

.login-brand-mark {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  color: var(--auth-white);
  transform: rotate(-8deg);
  box-shadow: 0 14px 28px rgba(37, 99, 235, 0.26);
}

.login-brand-mark svg,
.feature-icon svg,
.auth-input svg,
.password-toggle svg,
.security-note svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.brand-copy {
  max-width: 650px;
  margin-top: 64px;
}

.brand-copy h1 {
  margin: 0;
  font-size: 60px;
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: 0;
}

.brand-copy h1 span {
  display: block;
}

.gradient-text {
  display: inline-block;
  width: auto;
  max-width: 100%;
  color: var(--auth-primary);
  background: linear-gradient(90deg, #2563eb, #0ea5e9);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-copy > p {
  max-width: 600px;
  margin: 24px 0 0;
  color: #cbd5e1;
  font-size: 18px;
  font-weight: 500;
  line-height: 1.65;
}

.feature-list {
  display: grid;
  gap: 20px;
  margin-top: 28px;
}

.feature-highlight {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  align-items: center;
  gap: 16px;
}

.feature-icon {
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(37, 99, 235, 0.46);
  border-radius: 12px;
  background: rgba(37, 99, 235, 0.16);
  color: #3b9dff;
  box-shadow: 0 0 24px rgba(37, 99, 235, 0.16);
}

.feature-icon svg {
  width: 28px;
  height: 28px;
}

.feature-highlight strong,
.feature-highlight small {
  display: block;
}

.feature-highlight strong {
  font-size: 16px;
  font-weight: 600;
  line-height: 24px;
}

.feature-highlight small {
  max-width: 440px;
  margin-top: 2px;
  color: #b8c4d9;
  font-size: 14px;
  font-weight: 400;
  line-height: 1.55;
}

.auth-panel {
  grid-area: auth;
  display: grid;
  align-items: start;
  justify-items: start;
  min-width: 0;
  padding: 62px 48px 130px 0;
}

.auth-card {
  width: min(650px, 100%);
  min-width: 0;
  min-height: 610px;
  padding: 66px 88px 48px;
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 20px;
  background: var(--auth-white);
  color: var(--auth-text);
  box-shadow: 0 20px 80px rgba(0, 0, 0, 0.22);
}

.auth-card header {
  text-align: center;
}

.auth-card h2 {
  margin: 0;
  font-size: 32px;
  font-weight: 700;
  line-height: 40px;
}

.auth-card header p {
  margin: 8px 0 0;
  color: var(--auth-muted);
  font-size: 17px;
  font-weight: 500;
  line-height: 24px;
}

.sso-stack {
  display: grid;
  gap: 14px;
  margin-top: 42px;
}

.sso-button {
  height: 60px;
  min-width: 0;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  background: var(--auth-white);
  color: var(--auth-text);
  font-size: 17px;
  font-weight: 600;
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.sso-button[hidden] {
  display: none;
}

.sso-button:hover {
  border-color: #94a3b8;
  background: #f8fafc;
  transform: translateY(-1px);
}

.microsoft-mark {
  width: 24px;
  height: 24px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 2px;
}

.microsoft-mark i:nth-child(1) { background: #f25022; }
.microsoft-mark i:nth-child(2) { background: #7fba00; }
.microsoft-mark i:nth-child(3) { background: #00a4ef; }
.microsoft-mark i:nth-child(4) { background: #ffb900; }

.google-mark {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  color: #4285f4;
  font-size: 24px;
  font-weight: 800;
}

.google-mark svg {
  width: 24px;
  height: 24px;
}

.invitation-banner,
.auth-error {
  margin: 24px 0 0;
  padding: 13px 15px;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.5;
}

.invitation-banner {
  border: 1px solid #bfdbfe;
  background: #eff6ff;
  color: #1e40af;
}

.auth-error {
  border: 1px solid #fecaca;
  background: #fef2f2;
  color: #991b1b;
}

.enterprise-auth-note {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 12px;
  margin-top: 28px;
  padding: 18px;
  border: 1px solid #dbeafe;
  border-radius: 12px;
  background: #f8fbff;
  color: #1e3a8a;
}

.enterprise-auth-note svg {
  width: 28px;
  height: 28px;
  fill: none;
  stroke: #2563eb;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.enterprise-auth-note strong,
.enterprise-auth-note small {
  display: block;
}

.enterprise-auth-note strong {
  font-size: 14px;
}

.enterprise-auth-note small {
  margin-top: 4px;
  color: #64748b;
  font-size: 12px;
  line-height: 1.5;
}

.sso-button.is-loading {
  cursor: wait;
  opacity: 0.72;
}

.auth-divider {
  height: 62px;
  display: flex;
  align-items: center;
  gap: 16px;
  color: var(--auth-muted);
  font-size: 14px;
  font-weight: 500;
}

.auth-divider::before,
.auth-divider::after {
  height: 1px;
  flex: 1;
  background: #cbd5e1;
  content: "";
}

.field-label {
  display: block;
  margin: 0 0 8px;
  font-size: 14px;
  font-weight: 600;
  line-height: 20px;
}

.auth-input {
  height: 56px;
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  margin-bottom: 26px;
  padding: 0 16px;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  color: #718096;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.auth-input:focus-within {
  border-color: var(--auth-primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.auth-input svg {
  width: 20px;
  height: 20px;
}

.auth-input input {
  min-width: 0;
  border: 0;
  outline: 0;
  color: var(--auth-text);
  font-size: 16px;
  font-weight: 500;
}

.auth-input input::placeholder {
  color: #94a3b8;
}

.password-toggle {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #64748b;
  cursor: pointer;
}

.password-toggle:hover {
  background: #f1f5f9;
}

.remember-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 2px;
  font-size: 14px;
  font-weight: 500;
}

.remember-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.remember-check input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--auth-primary);
}

.remember-row a,
.admin-contact a {
  color: var(--auth-primary);
  text-decoration: none;
}

.sign-in-button {
  width: 100%;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  margin-top: 34px;
  border: 0;
  border-radius: 12px;
  background: linear-gradient(90deg, #2563eb, #1d4ed8);
  color: var(--auth-white);
  font-size: 18px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(37, 99, 235, 0.24);
  transition: box-shadow 160ms ease, transform 160ms ease;
}

.sign-in-button:hover {
  box-shadow: 0 14px 28px rgba(37, 99, 235, 0.32);
  transform: translateY(-1px);
}

.sign-in-button span {
  font-size: 25px;
  font-weight: 400;
}

.admin-contact {
  margin: 34px 0 0;
  color: var(--auth-muted);
  font-size: 14px;
  font-weight: 500;
  text-align: center;
}

.login-footer {
  position: absolute;
  right: 5vw;
  bottom: 24px;
  width: 60%;
  color: #a8b4c8;
  font-size: 13px;
  font-weight: 400;
  text-align: center;
}

.login-footer p {
  margin: 10px 0 0;
}

.login-footer a {
  color: #b8c4d9;
  text-decoration: none;
}

.login-footer p:last-child {
  display: flex;
  justify-content: center;
  gap: 16px;
}

.security-note {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.security-note svg {
  width: 20px;
  height: 20px;
}

@media (max-width: 1180px) {
  .login-page {
    grid-template-columns: 1fr;
    grid-template-areas:
      "brand"
      "auth";
    overflow: visible;
  }

  .brand-panel {
    min-height: 760px;
    padding: 48px 7vw 120px;
  }

  .brand-copy h1 {
    font-size: 56px;
  }

  .auth-panel {
    justify-items: center;
    padding: 64px 7vw 180px;
  }

  .auth-card {
    min-height: auto;
  }

  .login-footer {
    right: 7vw;
    bottom: 28px;
    width: 86%;
  }
}

@media (max-width: 640px) {
  body {
    overflow-x: hidden;
  }

  .login-page {
    display: flex;
    flex-direction: column;
    grid-template-areas:
      "auth"
      "brand";
    width: 100%;
    max-width: 100%;
    background-image: radial-gradient(circle at center, #0f172a 0%, #020617 60%, #01040f 100%);
  }

  .auth-panel {
    display: block;
    order: 1;
    min-width: 0;
    width: 100%;
    padding: 24px 0 40px;
  }

  .auth-card {
    width: min(312px, 100%);
    max-width: 100%;
    margin: 0 16px;
    padding: 28px 20px;
    border-radius: 16px;
  }

  .auth-card h2 {
    font-size: 28px;
    line-height: 36px;
  }

  .sso-stack {
    margin-top: 28px;
  }

  .sso-button {
    gap: 12px;
    font-size: 15px;
  }

  .sso-button span:last-child {
    min-width: 0;
    white-space: nowrap;
  }

  .remember-row {
    align-items: flex-start;
    flex-wrap: wrap;
    justify-content: flex-start;
    font-size: 13px;
  }

  .remember-row a {
    margin-left: auto;
    white-space: nowrap;
  }

  .brand-panel {
    order: 2;
    min-width: 0;
    width: 100%;
    min-height: auto;
    padding: 32px 20px 160px;
  }

  .login-brand {
    font-size: 26px;
  }

  .brand-copy {
    margin-top: 32px;
  }

  .brand-copy h1 {
    font-size: 34px;
  }

  .gradient-text {
    display: block;
    max-width: 100%;
    overflow-wrap: anywhere;
  }

  .brand-copy > p {
    max-width: 350px;
    overflow-wrap: anywhere;
  }

  .brand-copy > p {
    font-size: 16px;
  }

  .feature-list {
    display: none;
  }

  .login-footer {
    right: 20px;
    bottom: 20px;
    width: calc(100% - 40px);
    font-size: 11px;
  }

  .login-footer p:last-child {
    flex-wrap: wrap;
    gap: 8px;
  }
}

@media (max-height: 820px) and (min-width: 1181px) {
  .brand-panel {
    padding-top: 32px;
  }

  .brand-copy {
    margin-top: 28px;
  }

  .brand-copy h1 {
    font-size: 46px;
  }

  .feature-list {
    gap: 12px;
    margin-top: 18px;
  }

  .feature-icon {
    width: 48px;
    height: 48px;
  }

  .auth-panel {
    padding-top: 24px;
    padding-bottom: 100px;
  }

  .auth-card {
    padding: 32px 40px;
  }

  .sso-stack {
    margin-top: 24px;
  }

  .auth-divider {
    height: 44px;
  }

  .auth-input {
    margin-bottom: 16px;
  }

  .sign-in-button,
  .admin-contact {
    margin-top: 20px;
  }
}
