@font-face {
  font-family: "Outfit";
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url("../fonts/outfit-latin.woff2") format("woff2");
}

*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: "Outfit", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background-color: #f3f4f6;
  color: #333;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 48px 16px 36px;
}

[hidden] {
  display: none !important;
}

button,
input {
  font: inherit;
}

button,
a {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
}

:focus-visible {
  outline: 3px solid #e60000;
  outline-offset: 2px;
}

.auth-topbar {
  position: absolute;
  top: 24px;
  left: 28px;
}

.auth-brand {
  color: #1f2937;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.5px;
  text-decoration: none;
}

.auth-brand:hover {
  color: #1d4ed8;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.container {
  background-color: #fff;
  border: 1px solid #e5e5e5;
  border-radius: 30px;
  position: relative;
  overflow: hidden;
  width: 768px;
  max-width: 100%;
  min-height: 480px;
}

.container p {
  font-size: 13px;
  line-height: 20px;
  letter-spacing: 0.3px;
  margin: 12px 0;
}

.container span {
  font-size: 12px;
}

.container button {
  background-color: #1d4ed8;
  color: #fff;
  font-size: 12px;
  padding: 12px 45px;
  min-height: 44px;
  border: 1px solid #1d4ed8;
  border-radius: 8px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-top: 10px;
}

.container button:hover {
  background-color: #1741b8;
}

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

.container button.is-loading,
.auth-dialog-inner button.is-loading {
  position: relative;
  color: transparent !important;
  cursor: progress !important;
}

.container button.is-loading::after,
.auth-dialog-inner button.is-loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 18px;
  height: 18px;
  margin: -9px 0 0 -9px;
  border: 2px solid rgba(255, 255, 255, 0.45);
  border-top-color: #fff;
  border-radius: 50%;
  animation: button-spin 700ms linear infinite;
}

.auth-dialog-inner .text-link.is-loading::after {
  border-color: rgba(203, 213, 225, 0.4);
  border-top-color: #cbd5e1;
}

@media (prefers-reduced-motion: reduce) {
  .container button.is-loading::after,
  .auth-dialog-inner button.is-loading::after {
    animation: none;
    border-top-color: rgba(255, 255, 255, 0.45);
  }

  .auth-dialog-inner .text-link.is-loading::after {
    border-top-color: rgba(203, 213, 225, 0.4);
  }
}

.container button.hidden {
  background: transparent;
  border-color: #fff;
  box-shadow: none;
  color: #fff;
}

.container button.hidden:hover {
  background: #fff;
  color: #1d4ed8;
}

.container form {
  background-color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  padding: 22px 40px;
  height: 100%;
}

.form-title {
  font-size: 30px;
  line-height: 38px;
  font-weight: 700;
  margin-bottom: 4px;
}

.field {
  width: 100%;
  text-align: left;
  margin: 4px 0;
}

.field label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: #555;
  margin-bottom: 4px;
}

.field-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 18px;
}

.field-head label {
  margin-bottom: 0;
}

.field-error {
  color: #b30000;
  font-size: 11px;
  font-weight: 600;
  text-align: right;
}

.container input {
  background-color: #eee;
  border: 1px solid transparent;
  padding: 10px 15px;
  min-height: 44px;
  font-size: 13px;
  border-radius: 8px;
  width: 100%;
  color: #333;
  outline: none;
}

.container input::placeholder {
  color: #666;
}

.container input:focus {
  border-color: #1f2937;
  box-shadow: none;
}

.container input.is-invalid,
.container input.is-invalid:focus {
  border-color: #e60000;
}

.password-control {
  position: relative;
}

.password-control input {
  padding-right: 52px;
}

.container .password-toggle {
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  min-height: 44px;
  padding: 0;
  margin: 0;
  background-color: transparent;
  border: 0;
  border-radius: 0;
  color: #555;
  font-size: inherit;
  letter-spacing: normal;
  text-transform: none;
}

.container .password-toggle:hover {
  background-color: transparent;
  color: #1f2937;
}

.container .password-toggle:active {
  background-color: transparent;
  color: #111827;
}

.form-error {
  color: #b30000;
  font-size: 12px;
  font-weight: 600;
  min-height: 18px;
}

.toast-stack {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 2147483000;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  max-width: calc(100% - 32px);
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: auto;
  max-width: 100%;
  padding: 12px 12px 12px 14px;
  background-color: #fff;
  border: 1px solid #e5e5e5;
  border-left: 4px solid #b30000;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.1);
  transform: translateX(calc(100% + 24px));
  transition: transform 240ms ease;
  pointer-events: auto;
}

.toast.is-visible {
  transform: translateX(0);
}

.toast.is-leaving {
  transform: translateX(calc(100% + 24px));
}

.toast-success {
  border-left-color: #15803d;
}

.toast-success .toast-mark {
  background-color: #15803d;
}

.toast-mark {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background-color: #b30000;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
}

.toast-message {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  color: #1f2937;
  font-size: 13px;
  line-height: 20px;
  overflow-wrap: anywhere;
}

.toast-close {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin: -10px -8px -10px 0;
  padding: 0;
  background-color: transparent;
  border: 0;
  border-radius: 8px;
  color: #555;
}

.toast-close:hover {
  background-color: rgba(31, 41, 55, 0.08);
  color: #1f2937;
}

.toast-close:active {
  background-color: rgba(31, 41, 55, 0.14);
}

.form-container {
  position: absolute;
  top: 0;
  height: 100%;
  transition: all 0.6s ease-in-out;
}

.sign-in {
  left: 0;
  width: 50%;
  z-index: 2;
}

.container.active .sign-in {
  transform: translateX(100%);
}

.sign-up {
  left: 0;
  width: 50%;
  opacity: 0;
  z-index: 1;
}

.container.active .sign-up {
  transform: translateX(100%);
  opacity: 1;
  z-index: 5;
}

@keyframes move {
  0%, 49.99% {
    opacity: 0;
    z-index: 1;
  }
  50%, 100% {
    opacity: 1;
    z-index: 5;
  }
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  margin: 10px 0 2px;
  color: #666;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  text-indent: 0.5px;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1 1 0;
  height: 1px;
  background-color: #d1d5db;
}

.social-icons {
  display: flex;
  gap: 6px;
  margin: 0;
}

.social-icons .icons {
  border: 1px solid #d1d5db;
  border-radius: 50%;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  min-height: 44px;
  padding: 0;
  margin: 0;
  background: transparent;
  box-shadow: none;
  color: #333;
  font-size: 19px;
  text-transform: none;
}

.google-icon {
  display: block;
}

.social-icons .icons:hover {
  background-color: #f2f2f2;
}

.toggle-container {
  position: absolute;
  top: 0;
  left: 50%;
  width: 50%;
  height: 100%;
  overflow: hidden;
  transition: all 0.6s ease-in-out;
  border-radius: 20px;
  z-index: 1000;
}

.container.active .toggle-container {
  transform: translateX(-100%);
}

.toggle {
  background-color: #1f2937;
  color: #fff;
  position: relative;
  left: -100%;
  height: 100%;
  width: 200%;
  transform: translateX(0);
  transition: transform 0.6s ease-in-out;
}

.container.active .toggle {
  background-color: #1f2937;
  transform: translateX(50%);
}

.toggle-panel {
  position: absolute;
  width: 50%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  padding: 0 30px;
  text-align: center;
  top: 0;
  transform: translateX(0);
  transition: all 0.6s ease-in-out;
}

.toggle-title {
  font-size: 26px;
  line-height: 34px;
  font-weight: 700;
}

.toggle-panel p {
  color: #fff;
}

.toggle-panel::before {
  content: '';
  position: absolute;
  inset: 0;
  background-repeat: no-repeat;
  background-position: center;
  background-size: 100% auto;
  opacity: 0.4;
  pointer-events: none;
}

.toggle-panel > * {
  position: relative;
  z-index: 1;
}

.toggle-panel button:focus-visible {
  outline-color: #fff;
}

.toggle-left {
  background-color: #1f2937;
  transform: translateX(-200%);
}

.container.active .toggle-left {
  transform: translateX(0);
}

.toggle-right {
  right: 0;
  background-color: #1f2937;
  transform: translateX(0);
}

.container.active .toggle-right {
  transform: translateX(200%);
}

.text-link {
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  color: #333 !important;
  font-size: 12px !important;
  font-weight: 500 !important;
  letter-spacing: 0 !important;
  text-transform: none !important;
  min-height: 32px !important;
  padding: 4px 8px !important;
  margin-top: 4px !important;
}

.text-link:hover {
  text-decoration: underline;
}

.login-options {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
}

.remember-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #555;
  font-size: 12px;
  cursor: pointer;
}

.remember-label input {
  flex: 0 0 16px;
  width: 16px;
  height: 16px;
  min-height: 16px;
  padding: 0;
  margin: 0;
  border: 0;
  background: transparent;
  accent-color: #1f2937;
  cursor: pointer;
}

.login-options .text-link {
  margin-top: 0 !important;
  padding: 4px 0 !important;
}

.mobile-switch {
  display: none;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  color: #1d4ed8 !important;
  font-size: 12px !important;
  font-weight: 600 !important;
  letter-spacing: 0 !important;
  text-transform: none !important;
  min-height: 44px !important;
  padding: 8px !important;
  margin-top: 2px !important;
}

.mobile-switch:hover {
  text-decoration: underline;
}

.auth-dialog {
  position: fixed;
  inset: auto;
  margin: 0;
  border: 0;
  border-radius: 12px;
  padding: 0;
  width: min(320px, calc(100% - 24px));
  max-height: calc(100dvh - 24px);
  overflow: auto;
  background-color: #fff;
  border: 1px solid #e5e5e5;
  box-shadow: 0 3px 12px rgba(15, 23, 42, 0.14);
}

.auth-dialog::backdrop {
  background: transparent;
}

.auth-dialog-inner {
  padding: 20px;
  text-align: left;
}

.auth-dialog-inner h2 {
  font-size: 18px;
  line-height: 26px;
  color: #1f2937;
  margin-bottom: 12px;
}

.auth-dialog-inner p {
  font-size: 13px;
  line-height: 21px;
  color: #4b5563;
  margin-bottom: 20px;
}

.auth-dialog-inner button {
  background-color: #1d4ed8;
  color: #fff;
  border: 1px solid #1d4ed8;
  border-radius: 8px;
  min-height: 44px;
  padding: 10px 24px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.auth-dialog-inner button:hover {
  background-color: #1741b8;
}

.reset-actions {
  display: flex;
  gap: 8px;
  margin-top: 14px;
}

.reset-actions button {
  flex: 0 0 calc(50% - 4px);
  width: calc(50% - 4px);
  min-width: 0;
  padding: 10px 14px;
  white-space: nowrap;
}

.auth-dialog-inner form {
  margin-top: 0;
}

.auth-dialog input {
  background-color: #eee;
  border: 1px solid transparent;
  padding: 10px 15px;
  min-height: 44px;
  font-size: 13px;
  border-radius: 8px;
  width: 100%;
  color: #333;
  outline: none;
}

.auth-dialog input:focus {
  border-color: #1f2937;
  box-shadow: none;
}

.auth-dialog input.is-invalid,
.auth-dialog input.is-invalid:focus {
  border-color: #e60000;
}

.auth-dialog .field label {
  color: #374151;
}

.auth-dialog .form-error {
  color: #b30000;
}

.auth-dialog .verify-code {
  display: flex;
  gap: 8px;
  justify-content: center;
}

.auth-dialog .verify-code input {
  width: 44px;
  min-width: 44px;
  height: 48px;
  min-height: 48px;
  padding: 0;
  margin: 0;
  text-align: center;
  font-size: 18px;
  font-weight: 600;
}

.auth-dialog .text-link {
  display: inline-flex;
  align-items: center;
  color: #1d4ed8 !important;
  min-height: 44px !important;
  margin-left: 0 !important;
}

.auth-dialog #verify-resend-timer {
  display: inline-block;
  min-width: 48px;
  text-align: left;
  color: #6b7280;
  font-variant-numeric: tabular-nums;
}

.auth-dialog .reset-success {
  color: #15803d;
}

.reset-success {
  color: #1d4ed8;
  font-size: 12px;
  font-weight: 600;
  line-height: 19px;
  margin: 12px 0;
}

.auth-dialog-inner button.reset-close {
  background-color: transparent;
  border: 1px solid #d1d5db;
  color: #374151;
}

.auth-dialog-inner button.reset-close:hover {
  background-color: rgba(31, 41, 55, 0.08);
  color: #1f2937;
}

@media (min-width: 781px) {
  .container.animate-switch.active .sign-up {
    animation: move 0.6s;
  }

  .auth-dialog {
    overflow: visible;
  }

  .auth-dialog-inner {
    max-height: calc(100dvh - 48px);
    overflow: auto;
    border-radius: 12px;
  }

  .auth-dialog[data-placement]::before,
  .auth-dialog[data-placement]::after {
    content: '';
    position: absolute;
    left: var(--arrow-x, 50%);
    width: 0;
    height: 0;
    border-style: solid;
    transform: translateX(-50%);
    pointer-events: none;
  }

  .auth-dialog[data-placement='bottom']::before {
    top: -9px;
    border-width: 0 9px 9px 9px;
    border-color: transparent transparent #e5e5e5 transparent;
  }

  .auth-dialog[data-placement='bottom']::after {
    top: -8px;
    border-width: 0 8px 8px 8px;
    border-color: transparent transparent #fff transparent;
  }

  .auth-dialog[data-placement='top']::before {
    bottom: -9px;
    border-width: 9px 9px 0 9px;
    border-color: #e5e5e5 transparent transparent transparent;
  }

  .auth-dialog[data-placement='top']::after {
    bottom: -8px;
    border-width: 8px 8px 0 8px;
    border-color: #fff transparent transparent transparent;
  }
}

@media (max-width: 780px) {
  body {
    padding: 36px 12px 24px;
  }

  .auth-topbar {
    top: 8px;
    left: 18px;
  }

  .auth-brand {
    font-size: 18px;
  }

  .container {
    width: 100%;
    min-height: 605px;
    border-radius: 24px;
    --card-h: 605px;
    --panel-h: 180px;
  }

  .container form {
    padding: 16px 20px;
  }

  .form-container {
    top: 0;
    left: 0;
    width: 100%;
    height: calc(100% - var(--panel-h));
    transition: transform 0.6s ease-in-out, opacity 0.3s ease-in-out;
  }

  .container.active .form-container,
  .container.active .sign-in,
  .container.active .sign-up {
    transform: translateY(var(--panel-h));
  }

  .toggle-container {
    top: auto;
    bottom: 0;
    left: 0;
    width: 100%;
    height: var(--panel-h);
    border-radius: 0 0 24px 24px;
    transition: transform 0.6s ease-in-out, border-radius 0.6s ease-in-out;
  }

  .container.active .toggle-container {
    transform: translateY(calc(var(--panel-h) - var(--card-h)));
    border-radius: 24px 24px 0 0;
  }

  .toggle,
  .container.active .toggle {
    left: 0;
    top: -100%;
    width: 100%;
    height: 200%;
    background-color: #1f2937;
    transform: translateY(0);
  }

  .container.active .toggle {
    background-color: #1f2937;
    transform: translateY(50%);
  }

  .toggle-panel {
    left: 0;
    top: 0;
    width: 100%;
    height: 50%;
    padding: 8px 16px;
  }

  .toggle-left {
    background-color: #1f2937;
    transform: translateY(-200%);
  }

  .container.active .toggle-left {
    transform: translateY(0);
  }

  .toggle-right {
    top: auto;
    right: auto;
    bottom: 0;
    background-color: #1f2937;
    transform: translateY(0);
  }

  .container.active .toggle-right {
    transform: translateY(200%);
  }

  .toggle-title {
    font-size: 20px;
    line-height: 26px;
  }

  .toggle-panel p {
    font-size: 11px;
    line-height: 16px;
    margin: 8px 0;
  }

  .toggle-panel::before {
    background-size: auto 100%;
  }

  .sign-in {
    transform: translateY(0);
    opacity: 1;
    z-index: 2;
    transition: transform 0.6s ease-in-out, opacity 0.3s ease-in-out 0.3s;
  }

  .sign-up {
    transform: translateY(16px);
    opacity: 0;
    z-index: 1;
    pointer-events: none;
    transition: transform 0.6s ease-in-out, opacity 0.3s ease-in-out;
  }

  .container.active .sign-in {
    transform: translateY(calc(var(--panel-h) - 16px));
    opacity: 0;
    z-index: 1;
    pointer-events: none;
    transition: transform 0.6s ease-in-out, opacity 0.3s ease-in-out;
  }

  .container.active .sign-up {
    transform: translateY(var(--panel-h));
    opacity: 1;
    z-index: 5;
    pointer-events: auto;
    transition: transform 0.6s ease-in-out, opacity 0.3s ease-in-out 0.3s;
  }

  .mobile-switch {
    display: none;
  }

  .toast-stack {
    top: 12px;
    right: 12px;
    max-width: calc(100% - 24px);
  }

  .auth-dialog {
    inset: auto 0 0 0;
    margin: 0;
    width: 100%;
    max-width: 100%;
    max-height: calc(85dvh - env(safe-area-inset-bottom, 0px));
    border-radius: 20px 20px 0 0;
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }

  .auth-dialog::backdrop {
    background: rgba(0, 0, 0, 0.6);
  }

  .auth-dialog::before {
    content: '';
    display: block;
    width: 36px;
    height: 4px;
    border-radius: 2px;
    background-color: #ccc;
    margin: 10px auto 0;
  }

  .auth-dialog input {
    font-size: 16px;
  }

  .auth-dialog-inner button[type='submit'] {
    padding: 10px 20px;
  }
}

@media (max-width: 380px) {
  .container form {
    padding: 18px 16px;
  }

  .toggle-title {
    font-size: 22px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
