@layer auth {
  .auth-body {
    min-height: 100dvh;
    overflow: auto;
    background: var(--app-bg);
  }

  .auth-shell {
    display: grid;
    min-height: 100dvh;
    padding: clamp(22px, 5vw, 72px);
    place-items: center;
  }

  .auth-frame {
    display: grid;
    grid-template-columns: minmax(330px, .84fr) minmax(440px, 1.16fr);
    width: min(1120px, 100%);
    min-height: min(670px, calc(100dvh - clamp(44px, 10vw, 144px)));
    overflow: hidden;
    border: var(--separator-width) solid var(--separator-color);
    border-radius: 22px;
    background: var(--sidebar-bg);
    direction: rtl;
  }

  .auth-showcase,
  .auth-panel {
    min-width: 0;
    direction: rtl;
  }

  .auth-showcase {
    position: relative;
    display: flex;
    overflow: hidden;
    padding: clamp(34px, 4.2vw, 58px);
    flex-direction: column;
    background: var(--accent);
    color: var(--on-accent);
    isolation: isolate;
  }

  .auth-showcase::before,
  .auth-showcase::after {
    position: absolute;
    z-index: -1;
    border: 1px solid color-mix(in srgb, var(--on-accent) 18%, transparent);
    border-radius: 999px;
    content: "";
  }

  .auth-showcase::before {
    top: -160px;
    left: -140px;
    width: 390px;
    height: 390px;
  }

  .auth-showcase::after {
    right: -170px;
    bottom: -200px;
    width: 470px;
    height: 470px;
  }

  .auth-brand,
  .auth-mobile-brand {
    display: inline-flex;
    width: fit-content;
    align-items: center;
    gap: 10px;
    font-size: 21px;
    font-weight: 700;
    letter-spacing: -.035em;
  }

  .auth-brand {
    color: var(--on-accent);
  }

  .auth-brand i,
  .auth-mobile-brand i {
    font-size: 30px;
  }

  .auth-showcase__visual {
    display: grid;
    flex: 1;
    place-items: center;
  }

  .auth-showcase__visual-ring {
    display: grid;
    width: clamp(138px, 15vw, 188px);
    height: clamp(138px, 15vw, 188px);
    place-items: center;
    border: 1px solid color-mix(in srgb, var(--on-accent) 28%, transparent);
    border-radius: 999px;
    background: color-mix(in srgb, var(--on-accent) 12%, transparent);
  }

  .auth-showcase__visual-ring i {
    font-size: clamp(76px, 8vw, 106px);
  }

  .auth-showcase__copy {
    max-width: 380px;
  }

  .auth-kicker {
    display: inline-flex;
    margin-bottom: 12px;
    color: color-mix(in srgb, var(--on-accent) 78%, transparent);
    font-size: 11px;
    font-weight: 700;
  }

  .auth-showcase h1 {
    font-size: clamp(32px, 3.7vw, 48px);
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: -.05em;
  }

  .auth-showcase p {
    max-width: 340px;
    margin-top: 16px;
    color: color-mix(in srgb, var(--on-accent) 78%, transparent);
    font-size: 13px;
    line-height: 1.7;
  }

  .auth-panel {
    position: relative;
    display: grid;
    padding: clamp(48px, 6vw, 82px);
    place-items: center;
    background: var(--sidebar-bg);
  }

  .auth-theme-button {
    position: absolute;
    top: 24px;
    left: 24px;
    display: grid;
    width: 42px;
    height: 42px;
    place-items: center;
    border: var(--separator-width) solid var(--separator-color);
    border-radius: 12px;
    color: var(--text-soft);
    font-size: 20px;
  }

  .auth-theme-button:hover {
    color: var(--text);
    background: var(--hover-bg);
  }

  html[data-theme="light"] .auth-theme-light,
  html[data-theme="dark"] .auth-theme-dark {
    display: none;
  }

  .auth-card {
    width: min(100%, 470px);
  }

  .auth-mobile-brand {
    display: none;
    margin-bottom: 40px;
    color: var(--accent);
  }

  .auth-card__header {
    margin-bottom: 32px;
  }

  .auth-card__eyebrow {
    color: var(--accent);
    font-size: 11px;
    font-weight: 700;
  }

  .auth-card h2 {
    margin-top: 8px;
    color: var(--text);
    font-size: clamp(30px, 3vw, 38px);
    font-weight: 700;
    letter-spacing: -.04em;
  }

  .auth-card__header p {
    margin-top: 9px;
    color: var(--text-soft);
    font-size: 13px;
  }

  .auth-form {
    display: grid;
    gap: 18px;
  }

  .auth-field {
    display: grid;
    gap: 8px;
    color: var(--text);
    font-size: 11.5px;
    font-weight: 600;
  }

  .auth-input {
    display: grid;
    grid-template-columns: 24px minmax(0, 1fr) auto;
    min-height: 56px;
    align-items: center;
    gap: 11px;
    padding: 0 16px;
    border: var(--separator-width) solid var(--separator-color);
    border-radius: 14px;
    background: transparent;
    transition: border-color var(--duration-fast) ease;
  }

  .auth-input:focus-within {
    border-color: color-mix(in srgb, var(--text-soft) 62%, var(--separator-color));
  }

  .auth-input > i {
    color: var(--icon);
    font-size: 20px;
  }

  .auth-input input {
    width: 100%;
    min-width: 0;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--text);
    direction: inherit;
    caret-color: var(--accent);
  }

  .auth-input input::placeholder {
    color: var(--text-soft);
    opacity: .74;
  }

  .auth-input input[type="email"] {
    direction: ltr;
    text-align: right;
  }

  .auth-input input:-webkit-autofill,
  .auth-input input:-webkit-autofill:hover,
  .auth-input input:-webkit-autofill:focus,
  .auth-input input:-webkit-autofill:active {
    -webkit-text-fill-color: var(--text);
    box-shadow: 0 0 0 1000px var(--sidebar-bg) inset;
    caret-color: var(--accent);
    transition: background-color 9999s ease-out 0s;
  }

  .auth-input button {
    display: grid;
    width: 34px;
    height: 34px;
    place-items: center;
    border-radius: 9px;
    color: var(--icon);
    font-size: 18px;
  }

  .auth-input button:hover {
    color: var(--text);
    background: var(--hover-bg);
  }

  .auth-security-note {
    display: flex;
    min-height: 22px;
    align-items: center;
    gap: 7px;
    color: var(--text-soft);
    font-size: 10.5px;
  }

  .auth-security-note i {
    color: var(--success);
    font-size: 17px;
  }

  .auth-checkbox {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--text-soft);
    font-size: 11px;
    font-weight: 400;
    cursor: pointer;
  }

  .auth-checkbox input {
    width: 17px;
    height: 17px;
    margin: 0;
    accent-color: var(--accent);
  }

  .auth-message {
    min-height: 20px;
    color: var(--text-soft);
    font-size: 11px;
  }

  .auth-message.is-error { color: var(--danger); }
  .auth-message.is-success { color: var(--success); }

  .auth-submit {
    display: flex;
    min-height: 56px;
    align-items: center;
    justify-content: center;
    gap: 12px;
    border-radius: 14px;
    background: var(--accent);
    color: var(--on-accent);
    font-weight: 700;
    transition: transform var(--duration-fast) ease, background-color var(--duration-fast) ease;
  }

  .auth-submit:hover { background: var(--accent-strong); }
  .auth-submit:active { transform: scale(.99); }
  .auth-submit:disabled { opacity: .62; cursor: wait; }
  .auth-submit i { font-size: 20px; }

  .auth-switch {
    margin-top: 24px;
    color: var(--text-soft);
    font-size: 12px;
    text-align: center;
  }

  .auth-switch a {
    color: var(--accent);
    font-weight: 700;
  }
}

@layer auth-responsive {
  @media (max-width: 880px) {
    .auth-shell {
      padding: 0;
      place-items: stretch;
    }

    .auth-frame {
      grid-template-columns: 1fr;
      width: 100%;
      min-height: 100dvh;
      border: 0;
      border-radius: 0;
    }

    .auth-showcase {
      display: none;
    }

    .auth-panel {
      min-height: 100dvh;
      padding: calc(34px + env(safe-area-inset-top)) 22px calc(32px + env(safe-area-inset-bottom));
    }

    .auth-theme-button {
      top: calc(18px + env(safe-area-inset-top));
      left: 18px;
    }

    .auth-card {
      width: min(100%, 480px);
    }

    .auth-mobile-brand {
      display: inline-flex;
    }

    .auth-card h2 {
      font-size: 31px;
    }
  }

  @media (max-width: 430px) {
    .auth-panel {
      align-items: center;
      padding-inline: 18px;
    }

    .auth-mobile-brand {
      margin-bottom: 34px;
    }

    .auth-card__header {
      margin-bottom: 28px;
    }

    .auth-input,
    .auth-submit {
      min-height: 54px;
    }
  }

  @media (max-height: 720px) and (min-width: 881px) {
    .auth-shell { padding-block: 24px; }
    .auth-frame { min-height: calc(100dvh - 48px); }
    .auth-panel { padding-block: 38px; }
    .auth-card__header { margin-bottom: 22px; }
    .auth-form { gap: 13px; }
    .auth-input, .auth-submit { min-height: 50px; }
  }
}
