/* Karma login — Material 3 Expressive, scoped only to the login form. */

body:has(#username):has(#password) {
  background: var(--md-sys-color-surface-container-lowest, #050b13) !important;
}

body:has(#username):has(#password) #root > div[class~="min-h-screen"][class~="flex"] {
  min-height: 100dvh !important;
  box-sizing: border-box;
  display: flex !important;
  align-items: stretch !important;
  justify-content: center !important;
  gap: 24px !important;
  padding: 28px !important;
  background: var(--md-sys-color-surface-container-lowest, #050b13) !important;
}

/* Visual pane */
body:has(#username):has(#password) #root > div[class~="min-h-screen"][class~="flex"]
  > div[class~="hidden"][class~="w-2/4"] {
  width: min(48%, 720px) !important;
  flex: 1 1 0 !important;
  min-width: 0 !important;
  border: 0 !important;
  border-radius: 32px !important;
  overflow: hidden !important;
  background: var(--md-sys-color-surface-container-high, #14243a) !important;
  box-shadow: none !important;
}

body:has(#username):has(#password) #root > div[class~="min-h-screen"][class~="flex"]
  > div[class~="hidden"][class~="w-2/4"] > div {
  width: 100% !important;
  height: 100% !important;
  padding: clamp(32px, 4vw, 64px) !important;
  box-sizing: border-box;
}

body:has(#username):has(#password) #root > div[class~="min-h-screen"][class~="flex"]
  > div[class~="hidden"][class~="w-2/4"] img {
  width: min(82%, 600px) !important;
  height: auto !important;
  max-height: 76vh !important;
  object-fit: contain !important;
}

/* Authentication surface */
body:has(#username):has(#password) #root > div[class~="min-h-screen"][class~="flex"]
  > div[class~="flex-1"][class~="w-2/4"] {
  width: min(48%, 640px) !important;
  flex: 0 1 640px !important;
  min-width: 440px !important;
  position: relative !important;
  box-sizing: border-box;
  align-items: center !important;
  justify-content: center !important;
  padding: 72px 64px 56px !important;
  border: 0 !important;
  border-radius: 32px !important;
  background: var(--md-sys-color-surface-container, #0f1c2d) !important;
  box-shadow: none !important;
}

/* Brand belongs to the auth surface rather than floating at the viewport edge. */
body:has(#username):has(#password) #root > div[class~="min-h-screen"][class~="flex"]
  > div[class~="flex-1"][class~="w-2/4"] > div[class~="absolute"] {
  top: 32px !important;
  left: 48px !important;
  right: auto !important;
  display: flex !important;
  align-items: center !important;
}

body:has(#username):has(#password) #root > div[class~="min-h-screen"][class~="flex"]
  > div[class~="flex-1"][class~="w-2/4"] > div[class~="absolute"] svg {
  width: auto !important;
  height: 34px !important;
  max-width: 140px !important;
  color: var(--md-sys-color-on-surface, #e5edf7) !important;
}

body:has(#username):has(#password) #root div[class~="max-w-md"] {
  width: 100% !important;
  max-width: 460px !important;
  margin: 0 !important;
}

body:has(#username):has(#password) #root div[class~="max-w-md"] > div:first-child {
  margin-bottom: 36px !important;
}

body:has(#username):has(#password) #root div[class~="max-w-md"] h2 {
  margin: 0 !important;
  color: var(--md-sys-color-on-surface, #e5edf7) !important;
  font-size: clamp(34px, 3vw, 44px) !important;
  line-height: 1.08 !important;
  font-weight: 760 !important;
  letter-spacing: -0.035em !important;
}

body:has(#username):has(#password) #root div[class~="max-w-md"] h2 + p {
  margin-top: 10px !important;
  color: var(--md-sys-color-on-surface-variant, #b8c8da) !important;
  font-size: 16px !important;
  line-height: 1.45 !important;
}

body:has(#username):has(#password) #root form {
  margin-top: 0 !important;
}

body:has(#username):has(#password) #root form > div[class~="space-y-4"] {
  display: grid !important;
  gap: 20px !important;
}

body:has(#username):has(#password) #root form label {
  margin-bottom: 8px !important;
  color: var(--md-sys-color-on-surface, #e5edf7) !important;
  font-size: 14px !important;
  line-height: 20px !important;
  font-weight: 650 !important;
}

body:has(#username):has(#password) #root :is(#username, #password) {
  width: 100% !important;
  height: 56px !important;
  box-sizing: border-box !important;
  padding: 0 18px !important;
  border: 0 !important;
  border-radius: 16px !important;
  outline: 0 !important;
  background: var(--md-sys-color-surface-container-high, #14243a) !important;
  color: var(--md-sys-color-on-surface, #e5edf7) !important;
  box-shadow: none !important;
  font-size: 16px !important;
  transition:
    background-color 180ms cubic-bezier(.2, 0, 0, 1),
    box-shadow 180ms cubic-bezier(.2, 0, 0, 1) !important;
}

body:has(#username):has(#password) #root :is(#username, #password)::placeholder {
  color: var(--md-sys-color-on-surface-variant, #b8c8da) !important;
  opacity: .68 !important;
}

body:has(#username):has(#password) #root :is(#username, #password):hover:not(:disabled) {
  background: var(--md-sys-color-surface-container-highest, #1a2c46) !important;
}

body:has(#username):has(#password) #root :is(#username, #password):focus-visible {
  background: var(--md-sys-color-surface-container-highest, #1a2c46) !important;
  box-shadow: 0 0 0 2px var(--md-sys-color-primary, #90caf9) !important;
}

body:has(#username):has(#password) #root form > div:last-child {
  margin-top: 28px !important;
}

body:has(#username):has(#password) #root form button[type="submit"] {
  width: 100% !important;
  min-height: 56px !important;
  padding: 0 24px !important;
  border: 0 !important;
  border-radius: 18px !important;
  background: var(--md-sys-color-primary, #90caf9) !important;
  color: var(--md-sys-color-on-primary, #003258) !important;
  box-shadow: none !important;
  font-size: 15px !important;
  font-weight: 740 !important;
  letter-spacing: .01em !important;
  transition:
    background-color 180ms cubic-bezier(.2, 0, 0, 1),
    transform 180ms cubic-bezier(.2, 0, 0, 1) !important;
}

body:has(#username):has(#password) #root form button[type="submit"]:hover:not(:disabled) {
  background: color-mix(in srgb, var(--md-sys-color-primary, #90caf9) 88%, white 12%) !important;
}

body:has(#username):has(#password) #root form button[type="submit"]:active:not(:disabled) {
  transform: scale(.985) !important;
}

body:has(#username):has(#password) #root form button[type="submit"]:focus-visible {
  outline: 0 !important;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--md-sys-color-primary, #90caf9) 30%, transparent) !important;
}

body:has(#username):has(#password) #root form button[type="submit"]:disabled {
  opacity: .52 !important;
  cursor: default !important;
}

/* Compact / phone layout: one contained authentication surface, no illustration. */
@media (max-width: 899px) {
  body:has(#username):has(#password) #root > div[class~="min-h-screen"][class~="flex"] {
    min-height: 100dvh !important;
    display: flex !important;
    align-items: flex-start !important;
    justify-content: center !important;
    padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom)) !important;
    gap: 0 !important;
  }

  body:has(#username):has(#password) #root > div[class~="min-h-screen"][class~="flex"]
    > div[class~="hidden"][class~="w-2/4"] {
    display: none !important;
  }

  body:has(#username):has(#password) #root > div[class~="min-h-screen"][class~="flex"]
    > div[class~="flex-1"][class~="w-2/4"] {
    width: 100% !important;
    max-width: 520px !important;
    min-width: 0 !important;
    min-height: calc(100dvh - max(32px, env(safe-area-inset-top) + env(safe-area-inset-bottom))) !important;
    flex: 0 1 auto !important;
    align-items: flex-start !important;
    justify-content: flex-start !important;
    padding: 100px 24px 32px !important;
    border-radius: 28px !important;
  }

  body:has(#username):has(#password) #root > div[class~="min-h-screen"][class~="flex"]
    > div[class~="flex-1"][class~="w-2/4"] > div[class~="absolute"] {
    top: 28px !important;
    left: 24px !important;
    right: auto !important;
  }

  body:has(#username):has(#password) #root > div[class~="min-h-screen"][class~="flex"]
    > div[class~="flex-1"][class~="w-2/4"] > div[class~="absolute"] svg {
    height: 32px !important;
    max-width: 132px !important;
  }

  body:has(#username):has(#password) #root div[class~="max-w-md"] {
    max-width: none !important;
  }

  body:has(#username):has(#password) #root div[class~="max-w-md"] > div:first-child {
    margin-bottom: 32px !important;
  }

  body:has(#username):has(#password) #root div[class~="max-w-md"] h2 {
    font-size: 34px !important;
  }

  body:has(#username):has(#password) #root :is(#username, #password),
  body:has(#username):has(#password) #root form button[type="submit"] {
    min-height: 56px !important;
  }
}

@media (max-width: 420px) {
  body:has(#username):has(#password) #root > div[class~="min-h-screen"][class~="flex"] {
    padding-left: 10px !important;
    padding-right: 10px !important;
  }

  body:has(#username):has(#password) #root > div[class~="min-h-screen"][class~="flex"]
    > div[class~="flex-1"][class~="w-2/4"] {
    padding-left: 20px !important;
    padding-right: 20px !important;
    border-radius: 24px !important;
  }

  body:has(#username):has(#password) #root > div[class~="min-h-screen"][class~="flex"]
    > div[class~="flex-1"][class~="w-2/4"] > div[class~="absolute"] {
    left: 20px !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  body:has(#username):has(#password) #root :is(#username, #password),
  body:has(#username):has(#password) #root form button[type="submit"] {
    transition-duration: .01ms !important;
  }
}
